gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
1.16k stars 36 forks source link

tach test not compatible with pytest-xdist? #386

Closed gwdekker closed 3 weeks ago

gwdekker commented 1 month ago

Hey! We seem to notice something interesting. We try to run tach test instead of pytest to speed up test execution loclly and on CI. However, it seems the case that tach test does not skip tests when we also use pytest-xdist on our test suite.

So,

tach test -- -n logical -m some_marker breaks the test selection and simple runs all tests,

while

tach test -- -m some_marker skips tests based on the test selection.

Is this a known/reproducible issue?

emdoyle commented 4 weeks ago

I am able to reproduce your issue, and I have traced it to this issue with pytest-xdist. It seems that plugins passed through the pytest.main entry-point are not provided to the workers.

I'll likely move our pytest plugin logic to its own file and delegate to pytest -p [tach] under the hood so that the subprocesses also inherit the plugin. I'll ping back here when this is ready.