proud-dentist-22844
07/30/2024, 5:42 AMpython_test targets. The script that normally runs the code under test manipulates PYTHONPATH (and actually mucks directly with sys.path). There is a bash script that handles manipulating the PYTHONPATH before running nosetest on those tests, thus accomplishing something similar. I want pants to run the tests, which means pytest instead of nosetest (hooray), but I've got to replace that PYTHONPATH manipulation logic within pants. Of course, within pants, I would actually need to extend PEX_EXTRA_SYS_PATH instead of PYTHONPATH (since pytest is run hermetically).
Has anyone else written a plugin that injects env vars for particular pytest runs?
PytestPluginSetup looks great, but it can only inject files in the pytest sandbox. I'm hoping there's a way to do this without extending PytestPluginSetup , so I can use it with released versions of pants.
Can plugins modify a target's field's value, say by injecting a value for python_test(extra_env_vars=...)?proud-dentist-22844
07/30/2024, 6:11 AMPytestPluginSetup was added (in part at least) based on a couple of use-cases I asked for help back then. https://github.com/pantsbuild/pants/pull/12091
The stevedore plugin (now part of pants) needed to inject an entry_points.txt file and another plugin that needed to detect if external services (like database) are available for the tests.
I guess extending that really is the best way forward.