Dear Flake8ers,

I am trying to run flake8 programmatically in a Test class as follows:

import flake8.main
import nose.tools as nt

class TestCodeFormat(object):
    def setUp(self):
        self.files = find_py_files(os.path.dirname(mmfutils.__file__))

    def test_flake8_conformance(self):
        # Pass in the files here so that config setup.cfg file gets found
        style_guide = flake8.main.get_style_guide(paths=self.files)
        result = style_guide.check_files()
        nt.eq_(result.total_errors, 0,
               "Found {0} code style errors (and warnings)."
               .format(result.total_errors))

The problem I am having is that there is no output when jobs > 1.  This is 
probably something to do with stdout flushing and multiprocessing when running 
under nosetests.

Is there any solution that will allow parallel processing with displayed 
output.  (I could change the error message to use result.messages or something, 
but don't see an easy way of properly formatting output with filenames and 
lines numbers etc.)

Thanks,
Michael.

P.S.

1) Please let me know if I should file an issue.  I thought this might be 
resolved by #21 but even using the latest sources does not help.

2) flake8 and python setup.py flake8 both work fine, so another solution would 
be if I can somehow trigger this from "python setup.py nosetests" or "python 
setup.py test" but it seems to be something of a challenge to customize 
setup.py commands.  

3) Setting nose's nocapture=1 also works, but the errors then are not deferred 
until the end of the tests and so can get lost.
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to