I'm going to preface this by acknowledging that it...
# general
b
I'm going to preface this by acknowledging that it's a weird question: Is there a way to specify different sets of
pytest
configuration declaratively (or even non-declaratively!) for different subsets of tests? Something like having different extra-requirements (https://www.pantsbuild.org/docs/reference-pytest#section-extra-requirements) for unit tests vs. integration tests?
s
(Chris's teammate here: We are thinking of doing --pytest-args="--no-cov")
👋 1
b
Yeah, that's probably the route we're going to end up going, but now I'm curious about the general case of different configurations for different segments of code... seems like a potentially interesting pattern 😄
h
The current way you do that is:
Alternatively, if you only want to install the plugin for certain tests, you can add the plugin to the dependencies field of your python_test / python_tests target. See Third-party dependencies for how to install Python dependencies. For example:
https://www.pantsbuild.org/docs/python-test-goal#pytest-version-and-plugins Will that work for you?
And then you can leverage
conftest.py
to dynamically change Pytest options etc on a per-test basis, iiuc
b
Ah, interesting! Thanks! We'll probably stick with
--no-cov
, but I'll keep this in mind for the future.
❤️ 1
h
I don't think I follow the
--no-cov
thing - is that to turn off coverage for all tests?
b
Yeah... it's really more of a peculiarity with our current testing setup, though.
Want to keep coverage for unit tests, but disable it for integration / end-to-end tests.