Where can I read more on how the `[test].extra_env...
# general
a
Where can I read more on how the
[test].extra_env_vars = ["VAR1", "VAR2=hardcoded_value"]
works or maybe even the
runtime_dependencies
field? Before my tests run, I want to package/deploy some custom non-python targets using some existing rules I have. And then provide some of the output of the package/deployment to the test (i.e. the location of the packaged file on "the cloud") Could have sworn there was some documentation on it, but I am lost 😞
the docs I find for extra env vars doesn’t say very much https://www.pantsbuild.org/docs/reference-test#extra_env_vars
was any of those what you were hoping for?
a
More along the lines of, how do I implement it?
Is there a union rule or something I can leverage to add my own additional files/environment to the pytest execution?
bah, meant to ask this in #plugins 🙃
😉 1
c
if you’re in a plugin, there seems to be a extra env vars field type you can sublclass and use on select target types. See https://github.com/pantsbuild/pants/blob/3b963628324f08ffbba8002dfec42ca8736a3758/src/python/pants/core/goals/test.py#L677-L688 and grep for any references on that how it is being used
a
Ah, doesn't look like it's generic.
c
you can make one that is from your plugin.. I think. If what you want to do is to pass env vars from any target to a test..?
a
before running the test I want to upload another target to 'the cloud', get back an ID of the uploaded artefact and then pass that ID into the test. either via environment variables, or a file.
c
Ah, maybe (ab?)use codegen, to have a target that generates the ID file
which the test may then depend on..
a
ahah it's codegen all the way down.
good idea tho
c
worth a shot 😉