Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox auto-provisioning not working #2634

Closed
johannesloibl opened this issue Dec 8, 2022 · 6 comments · Fixed by #2750
Closed

tox auto-provisioning not working #2634

johannesloibl opened this issue Dec 8, 2022 · 6 comments · Fixed by #2750
Labels
bug:normal affects many people or has quite an impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@johannesloibl
Copy link

Issue

When specifying

[tox]
requires =
    tox<4

and running this command with a tox version > 4.0.0, I expect that tox will provision a .tox/.tox directory with a version < 4.0.0.
But the created venv .tox does not get a tox installation. See console.

Environment

OS: Win 10, 64-bit
Python 3.9.13
tox 4.0.2

Output of running tox

Output of tox -e py39-dev:

C:\git\foo>tox -e py39-dev
ROOT: will run in automatically provisioned tox, host C:\Python39\python.exe is missing [requires (has)]: tox<4 (4.0.2)
ROOT: provision> .tox\.tox\Scripts\python.exe -m tox -e py39-dev
C:\git\foo\.tox\.tox\Scripts\python.exe: No module named tox
@gaborbernat
Copy link
Member

Can't replicate. Can you provide a reproducible here?

@gaborbernat gaborbernat added needs:more-info help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. labels Dec 8, 2022
@johannesloibl
Copy link
Author

johannesloibl commented Dec 8, 2022

Trying to reproduce right now with a minimal example, but that one seems to work.
I saw a similar issue on one of our Jenkins nodes that failed, maybe this gives you more information about what could have happened:
image
Seems like somehow for projects that transition between version 3 and 4, tox gets confused about which .tox directory to use, which is ending up in an endless adding up of ".tox" 😅

@gaborbernat
Copy link
Member

Sadly that's not enough to reproduce 😆 but I see what you mean.

@johannesloibl
Copy link
Author

Alright, now i got it:

[tox]
requires =
    tox<4

[testenv]
basepython = python3
deps =
    pytest

If you execute this within an environment that has tox 4.0.2 installed, you will see the error.
So autoprovisioning for downgrade is not working.

@johannesloibl
Copy link
Author

[tox]
requires =
    tox<4

[testenv]
basepython = python3

Executing this raises another error:
image

Shall i create another ticket for that or is it a user error?^^

@domdfcoding
Copy link

I can reproduce with the following tox.ini config:

[tox]
requires = numpy

[testenv]
skip_install = true
deps = -r{toxinidir}/tests/requirements.txt
commands =
    python --version

tests/requirements.txt is an empty file.

The output is:

$ tox
ROOT: will run in automatically provisioned tox, host /tmp/tox-issue/venv/bin/python3 is missing [requires (has)]: numpy
ROOT: provision> .tox/.tox/bin/python -m tox
/tmp/tox-issue/.tox/.tox/bin/python: No module named tox

If I remove the deps option from [testenv] it provisions (although in reality I need the dependencies installed for my tests to run):

$ tox
ROOT: will run in automatically provisioned tox, host /tmp/tox-issue/venv/bin/python3 is missing [requires (has)]: numpy
ROOT: install_deps> python -I -m pip install numpy 'tox>=4.0'
ROOT: provision> .tox/.tox/bin/python -m tox
py: commands[0]> python --version
Python 3.8.10
  py: OK (0.15=setup[0.14]+cmd[0.00] seconds)
  congratulations :) (0.48 seconds)

It seems that it's trying to install tests/requirements.txt into the root testenv, when it isn't required there (and wasn't installed there by tox 3) and not installing tox>=4.0

@gaborbernat gaborbernat added bug:normal affects many people or has quite an impact and removed needs:more-info labels Dec 9, 2022
@gaborbernat gaborbernat added this to the 4.0.x milestone Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:normal affects many people or has quite an impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants