rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

Allow setting environment variables in downstream tests

Open bollwyvl opened this issue 3 months ago • 2 comments

As always, thanks for rattler-build! 🤗

elevator pitch

Allow #/tests/*/downstream to provide environment variables used during the test run.

motivation

downstream tests are very useful. Sometimes, however, they need some "help" to not avoid not-upstream-under-test issues.

Many test tools allow for configuration via environment variables, and generally would be need less coordination between recipe maintainers for special cases than e.g. files-on-disk.

design ideas

Allow a downstream be a mapping, which at least initially includes env. For example, there is one failing test on https://github.com/conda-forge/jupyter_core-feedstock/pull/103 which could be solved via:

tests:
  - downstream:
      package: jupyter_server
      env:
        PYTEST_ADDOPTS: -k "not test_execution_state"

future work

One could certainly imagine expanding such a mapping to contain a requirements key to affect the solve during the test (e.g. to avoid some other upstream), but this would start getting complex rather quickly.

Even discounting any requirement, constraining the version of the downstream-under-testwould be useful for certain conditions:

tests:
  - downstream:
      package:
         name: jupyter_server
         version: 1.*
      env:
        PYTEST_ADDOPTS: -k "not test_execution_state"

Allowing the version to be a matrix (much like #/tests/*/python/python_version) might invite too much excitement, but channels might be very helpful for cross-validating complex pre-releases.

bollwyvl avatar Oct 16 '25 14:10 bollwyvl

I think that's a fair idea. It would theoretically need a CEP or an addendum to the existing CEP to spec the new field. We recently merged similar additions to the original recipe CEP. Are you open to write something up over there?

wolfv avatar Oct 27 '25 13:10 wolfv

Hmm... seems like a CEP might be a bit of a performative ceremony (or would need a precursor) as downstream tests don't work in both directions anyway: i've accepted I can't test jupyterlab's meta.yaml from ipykernel's recipe.yaml.

bollwyvl avatar Oct 27 '25 13:10 bollwyvl