flake8 has the doctests option that enables doctest checking. Unfortunately it's global.
In objgraph I have a file (objgraph.py) where the doctest syntax is used for examples, and another file (tests.py) where doctests are used for actual test code. If I set doctests = yes, I get false positives on objgraph.py about all the undefined names in my examples. If I set doctests = no, I get a false positive about 'import gc' in test.py being unused, despite gc.collect() being called in many doctests. Also, the code in my doctests doesn't get checked. Do you think it would make sense to be able to enable/disable doctest checking per file? I'm thinking either directives inside the files themselves, say: # flake8: +doctests or # flake8: -doctests or perhaps a list of glob patterns in setup.cfg, e.g. [flake8] doctests = tests.py (while keeping support for the boolean values, of course) Marius Gedminas -- We have enough youth, how about a fountain of SMART?
signature.asc
Description: Digital signature
_______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality