high-yak-8589901/20/2022, 10:26 PM
to not run modules called
. I know my
is getting picked up properly because I can see it with
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-5443401/20/2022, 10:28 PM
high-yak-8589901/20/2022, 10:32 PM
and fails which makes sense because it's not intended to work.
enough-analyst-5443401/20/2022, 10:35 PM
high-yak-8589901/20/2022, 10:35 PM
file got picked up happily but maybe pants is collecting tests before
gets a chance to say what should be collected?
enough-analyst-5443401/20/2022, 10:37 PM
high-yak-8589901/20/2022, 10:37 PM
, and that happens to match
, I can just rename my few
looking files to something like
so pytest never collects it.
enough-analyst-5443401/20/2022, 10:38 PM
that defeats your hook?
pytest .... all your files explicitly listed here as positional args
high-yak-8589901/20/2022, 10:39 PM
enough-analyst-5443401/20/2022, 10:40 PM
work? Presumably that's alot of churn to add though and your conftest hook approach is more transparent to end-user-tests.
@pytest.mark.skipif(function_to_determine_file_presence, reason="You don;t have required files.")
high-yak-8589901/20/2022, 10:42 PM
enough-analyst-5443401/20/2022, 10:48 PM
high-yak-8589901/20/2022, 10:49 PM
enough-analyst-5443401/20/2022, 10:50 PM
hundreds-father-40401/20/2022, 11:30 PM
high-yak-8589901/20/2022, 11:32 PM
python_files = *_test.py
already has a default glob pattern to include
, 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.
Exit code 0 - success, non-zero failure.is a problem. We have custom fixtures set up with our
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.