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
DM-11514: Fix some pytest problems #269
Conversation
timj
commented
Aug 8, 2017
•
edited
edited
- Use correct name of pytest initialization function.
- Rename a test file.
- Cleanup logic in SConscript to ignore pybind11 test files.
This is handled in the C++ tests, and the test_executables.py test does not trap for afwdata.
Otherwise the leak tester will trigger.
I'm a bit surprised by the "Ignore..." and "Fix name of..." commits, because I've run |
@kfindeisen if you run |
Ok, I didn't realize And yes, I understand the problem with |
Should have mentioned this PR is triggered by lsst/sconsUtils#34. |
@kfindeisen does this count as a review? |
No, I was asking for personal edification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure I understand the changes to stop testing for afwdir in tests/SConscript, but I assume they are correct (were you able to test them?).
One thing to consider: move the test in (formerly) testDir.py
to test_sourceTable.py
. The name of the test is a bit unclear and what it tests is an aspect of SourceTable. That said, it probably tests an aspect of all tables and so perhaps out to be rewritten to use SimpleTable. But I think simply moving it and deleting the old file would be good enough.
tests/SConscript
Outdated
@@ -10,6 +10,7 @@ afwdataDir = env.ProductDir("afwdata") | |||
if afwdataDir: | |||
env["ENV"]["AFWDATA_DIR"] = afwdataDir | |||
|
|||
scripts.BasicSConscript.tests(noBuildList=[name + '.cc' for name in pybind11_test_modules]) | |||
scripts.BasicSConscript.tests(noBuildList=[name + '.cc' for name in pybind11_test_modules], | |||
ignoreList=[name + '.py' for name in pybind11_test_modules]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious: why is this change needed? I suppose if you use pytest tests/*.py
instead of pytest
, as we may have to do initially, that would explain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to stop SCons from thinking that the pybind11 .py files are things that should be tested. This is important when we are in a mode where pytest runs each test file separately because pytest exits with bad status if no tests are found. See my comment above replying to @kfindeisen. With these changes pytest
without arguments would work but sconsUtils
is not yet set up to do that (that's a change we can make later once the basics are done).
The tweaking of the {{afwdata}} stuff in the SCons file is a left over of DM-609. We don't need to filter out any tests because the C++ tests trap the situation themselves. I have tested with and without afwdata. |