I have a couple more questions on my way to upgrad...
# general
b
I have a couple more questions on my way to upgrading pants to 2.11: 1. Is there a good way to get pytest to ignore
__init.py
,
common.py
or any other files that don't have tests in them? 2. I have some tests that import
.json
files, which traditionally have been provided using a resources target and then having
:test-files
in the dependencies for the
python_tests
. After changing the version to 2.11, I find that my tests are no longer able to load the test files like they had in the past. I tried switching to the
files
target from
resources
but that didn't change anything.
h
fwiw, I'm on 2.11 and use
files
and
resources
for lots of test files and it's working fine for me
w
After changing the version to 2.11, I find that my tests are no longer able to load the test files like they had in the past. I tried switching to the
files
target from
resources
but that didn’t change anything.
this might be related to source roots?: there were some default patterns in 1.30.x which are no longer installed. to confirm, you’d want to run
./pants roots
and see if you have a source root for the filesystem prefix of the
resources
that you expect to be cut off before you import them
👍 1
h
Is there a good way to get pytest to ignore __init.py , common.py or any other files that don't have tests in them?
You will want to make sure that they are not in the
sources
field of a
python_tests
"target generator". They should belong to
python_sources
You can use
./pants peek path/to/common.py
to see what the target type is
👍 1