Hi all :wave: , I have a question which I've not b...
# general
f
Hi all 👋 , I have a question which I've not been able to find an answer for in the docs or the GitHub issues threads. Is there a supported approach for running pytest against actual Pants build files? For context, I'm working in a mono-repo with multiple subprojects (each with their own dedicated resolve), and I want to have a small collection of unit tests which enforce certain invariants and conventions for specific target parameters. I'm currently able to do this on a per-subproject basis, but that would require duplicated test definitions per subproject.
h
So a test that consumes
BUILD
files as input?
And parses them and inspects them?
f
yeah exactly!
h
Here’s an example of doing something like this in the
example-python
repo:
There are likely a few sharp edges
for example, the test has to be above all the BUILD files in the filesystem, since targets can only glob over files at or below their directories
And there may be some other side-effects, since using a BUILD file as a resource in another BUILD file is unusual
f
ah nice, thank you for the example! This is somewhat similar to what I'm doing on one of my individual subprojects, but I didn't think to generalize by globbing all build files. It would be very cool if there were some way to inject the output of a
pants list
command into a
pytest.fixture
, but I'm guessing that approach likely has its own rough edges.