tests: pytest_collection_modifyitems hook to skip tests

It was previously using pytest_runtest_setup to skip tests, but this only
ran for tests that were in the tests/ directory, and not for the sourcetests.

Instead use pytest_collection_modifyitems which runs earlier and has access
to all collected tests. Since this runs earlier than the tests, we add a
skip marker to those tests we want to skip.

Comparing the tests that ran before and after this change, we see
* Before: 1 failed, 1258 passed, 200 skipped, 85 warnings in 116.92s (0:01:56)
* After: 1258 passed, 201 skipped, 85 warnings in 119.58s (0:01:59)

So `source_determinism.py::test_deterministic_source_umask[tar]` is indeed
the only test affected by this.
1 file changed