what is the approach people take when declaring fi...
# general
f
what is the approach people take when declaring files containing the Python code necessary for tests to run (e.g. some commons, utils, fixtures, constants)? Say file
commons.py
under the
tests
directory along with
test_*.py
files containing tests.
I don’t think it’s possible to include this file as
sources
for the 
python_tests
 target because there are no tests in this file - Pants will say it failed to run the tests in this file (because there are none), at least that’s what it does for me. It may make sense to make it a 
files
 or 
resources
 target (https://www.pantsbuild.org/v2.6/docs/reference-files), but slightly weird perhaps as both are used for data files such as binary test data or any other assets. Shall I consider it being a part of the library (to put under
python_library
)? It is not, really. I could overload the meaning of
resources
of Pants, however, and make it a
resources
instead despite it being a Python module intended to be imported.
h
Likely python_library is the right thing to do. Search for the subsection "test utilities" on https://www.pantsbuild.org/docs/python-test-goal
1