high-yak-85899
01/20/2022, 10:26 PMconftest.py
to not run modules called *_manual_test.py
. I know my conftest.py
is getting picked up properly because I can see it with ./pants dependencies
calls. Are there any special things to get conftest to apply other than making sure it's a dependency like that? The docs make it seem like it should just work ™️ after that.enough-analyst-54434
01/20/2022, 10:28 PMhigh-yak-85899
01/20/2022, 10:32 PMmy_manual_test.py
and fails which makes sense because it's not intended to work.high-yak-85899
01/20/2022, 10:32 PMenough-analyst-54434
01/20/2022, 10:35 PMhigh-yak-85899
01/20/2022, 10:35 PMpytest.ini
file got picked up happily but maybe pants is collecting tests before pytest
gets a chance to say what should be collected?enough-analyst-54434
01/20/2022, 10:37 PMhigh-yak-85899
01/20/2022, 10:37 PM*_test.py
, and that happens to match *_manual_test.py
, I can just rename my few *_manual_test.py
looking files to something like *_test_manual.py
so pytest never collects it.enough-analyst-54434
01/20/2022, 10:38 PMpytest .... all your files explicitly listed here as positional args
that defeats your hook?high-yak-85899
01/20/2022, 10:39 PMenough-analyst-54434
01/20/2022, 10:40 PM@pytest.mark.skipif(function_to_determine_file_presence, reason="You don;t have required files.")
work? Presumably that's alot of churn to add though and your conftest hook approach is more transparent to end-user-tests.high-yak-85899
01/20/2022, 10:42 PMhigh-yak-85899
01/20/2022, 10:47 PMenough-analyst-54434
01/20/2022, 10:48 PMhigh-yak-85899
01/20/2022, 10:49 PMenough-analyst-54434
01/20/2022, 10:50 PMenough-analyst-54434
01/20/2022, 10:50 PMhundreds-father-404
01/20/2022, 11:30 PMskip_tests
option: https://www.pantsbuild.org/docs/existing-repositories#3-set-up-testshigh-yak-85899
01/20/2022, 11:32 PMhigh-yak-85899
01/20/2022, 11:59 PMpython_files = *_test.py
in pytest.ini
but because python_tests
already has a default glob pattern to include test_*.py
, some files I didn't intend to have picked up were being executed. So, while maybe not a bug, it does seem important/restricting that collection happens without regard for what is in conftest.py or pytest.ini.high-yak-85899
01/21/2022, 4:30 AMExit code 0 - success, non-zero failure.is a problem. We have custom fixtures set up with our
conftest.py
and properly marked in the test file. As expected, that test shouldn't run without the proper marker applied with a run time flag. But, because pants collects them first and then doesn't run them, we get an exit code because no tests are run. A silly way to fix this is to put something like this in the file that has a marked test so that something runs and prevents the error from being thrown.
class DontLetPantsFail(unittest.TestCase):
def test_nothing(self):
pass