tox-conda: some conda-deps items not present in test environment

31 views Asked by At

I'm running tests for a python package using tox, tox-conda, and pytest. I am finding that pytest does not end up in my test environment if I list it in the conda-deps section of tox.ini, but it does if I list it under deps. tox.ini below; the py311-deps test environment works as expected, while the py311-condadeps environment prints out

py311-condadeps run-test: commands[2] | python -c 'import inspect, pytest; print('"'"'running pytest from: '"'"', inspect.getfile(pytest))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pytest'

Have I misunderstood something about conda-deps?

My tox.ini:

[tox]
requires = tox-conda
envlist = py311-{condadeps,deps}
isolated_build = True

[testenv]
commands =
         python -c "import sys; print('running python from: ', sys.executable)"
         python --version
         python -c "import inspect, pytest; print('running pytest from: ', inspect.getfile(pytest))"
         pytest --version
         pytest tests

# pytest not available in test environment
[testenv:py311-condadeps]
conda-deps =
        python=3.11
        pytest

# works as expected
[testenv:py311-deps]
conda-deps =
        python=3.11
deps =
     pytest
0

There are 0 answers