swift-river-73520
05/15/2023, 8:50 PMconftest.py
in the same way pytest does, even if a test target doesn't refer to any fixtures in conftest.py
? I am transitioning a repo to use pants, and when I run a target that doesn't use any fixtures it still seems to want to include the conftest file and all its dependencies. Is the only way around this to put the test in a folder that doesn't have conftest.py in one of its parent folders?
for example the tests are structured like this:
tests/
tests/confest.py
tests/foo/bar/test_file.py #doesn't refer to any fixtures in tests/conftest.pybitter-ability-32190
05/15/2023, 9:06 PMautouse=True
bitter-ability-32190
05/15/2023, 9:07 PMcurved-television-6568
05/15/2023, 9:21 PMIs the only way around this to put the test in a folder that doesn’t have conftest.py in one of its parent folders?If you want to preserve the directory structure, you may be able to exclude it with
!!tests/conftest.py
See “ignore dependencies with ! and !!” in https://www.pantsbuild.org/docs/targets#dependencies-field
N.b. I’ve only used this with 3rdparty requirements, not the conftest.py file, so not sure if it will actually work as desired.swift-river-73520
05/15/2023, 9:22 PM