https://pantsbuild.org/ logo
#general
Title
# general
a

average-australia-85137

03/08/2022, 8:02 PM
oh quick question about the docs: should the docs for the python_test_utils[1] say
although it behaves identically to the python_tests target generator and you can safely use that instead
instead of
although it behaves identically to the python_sources target generator and you can safely use that instead
It has the same default sources as python_tests just adding conftest:
Copy code
expected_file_extensions = (".py", "")  # Note that this does not include `.pyi`.
    default = ("test_*.py", "*_test.py", "tests.py")
Copy code
class PythonTestUtilsGeneratingSourcesField(PythonGeneratingSourcesBase):
    default = ("conftest.py", "test_*.pyi", "*_test.pyi", "tests.pyi")
[1] https://www.pantsbuild.org/docs/reference-python_test_utils#codesourcescode
h

hundreds-father-404

03/08/2022, 8:31 PM
It's correct - it is generating a
python_source
target per entry of
sources
. That's because
conftest.py
and
test_foo.pyi
are not actually tests - they should not be executed via Pytest
🙌 1
But I think this could probably use another sentence of explanation. I certainly see why it's confusing. Where is that first sentence coming from in the docs?
a

average-australia-85137

03/09/2022, 1:04 AM
ah - I guess based on that statement I would also expect it to pick up any other python sources even if they aren't named conftest that makes sense now but maybe could be more explained in the docs
h

hundreds-father-404

03/09/2022, 1:05 AM
ohhh "identically" is poor word choice, good feedback!
@average-australia-85137 could this section of docs be improved? https://www.pantsbuild.org/v2.10/docs/python-test-goal#test-utilities Agreed that https://www.pantsbuild.org/v2.10/docs/reference-python_test_utils is confusing
a

average-australia-85137

03/09/2022, 1:08 AM
oh yeah that is much clearer
h

hundreds-father-404

03/09/2022, 1:13 AM
4 Views