New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test command prevents other commands from running #850
Comments
For reference, https://gitlab.com/pycqa/flake8/blob/master/src/flake8/main/setuptools_command.py is the source for the setuptools |
Here are the differences between 18.3.2 and 18.4. It's not obvious to me how these changes are causing the swallowing of other commands, but given that the changes are largely related to the handling of command-line arguments, it seems entirely plausible that there's an error in there. Those changes were indicated as relating to #446, which suggests that perhaps the tests weren't even being run at all before. @scop, would you be willing to dive in and identify the underlying cause and maybe even put together a patch with possibly a test? |
I did a quick bisect session, and the issue was introduced in commit 3491076. Another finding is that the issue does not seem to happen in --dry-run mode (not even with the current master). Anyway, I found |
@scop I suspect Flake8 has a similar issue (using |
@sigmavirus24 similar yes, it raises a SystemExit if it found any issues. But it does not do that (nor exit otherwise) if no flake8 issues are found. I guess what this means or if anything should be done to it boils down to expected behavior for chained setuptools commands; if running e.g. |
@sigmavirus24 scratch that, the SystemExit in flake8 is always raised, even if there are no issues found (unless force-skipped with exit_zero). So I think something should be done to flake8 in any case; exactly what depends on my question on the expected behavior... |
Yeah, I don't know what the right behaviour is for setuptools commands honest, or how we communicate failure to setuptools. I blame distutils for that though, mainly because setuptools commands are just extensions of distutils commands and most of the logic still resides there. |
So looking at https://github.com/python/cpython/blob/master/Lib/distutils/cmd.py I don't see a way to communicate failure. |
Tell unittest.main not to exit, fixes #850.
The test command seems to prevent other commands from running. Looks like this issue was introduced in 18.4; in 18.3.2 it doesn't occur. Using https://github.com/pypa/sampleproject:
Setup:
With setuptools 18.3.2, both "setup.by build test" and "setup.py test build" run the specified commands in the expected order:
...but with 18.4 (and up to 28.8.0), "setup.py build test" runs both build and test, but "setup.py test build" does not run build at all.
While fiddling with the build and test commands this way may be a bit silly, the issue exists with other commands as well. Initially I thought this was a flaw in the flake8 command and reported this there, see https://gitlab.com/pycqa/flake8/issues/260. With flake8, the test command behaves differently/worse than with build (with which "build test" works); "flake8 test" runs flake8 but not test, and "test flake8" runs test, not flake8.
The text was updated successfully, but these errors were encountered: