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 recreates environment even if recreate = false set in configuration #1372

Closed
PJCampi opened this issue Jul 20, 2019 · 2 comments
Closed
Labels
area:documentation bug:normal affects many people or has quite an impact

Comments

@PJCampi
Copy link

PJCampi commented Jul 20, 2019

Hi guys,

First off thank you very much for the great work on the package!

I have always assumed that recreate = false implied that a tox environment would not be recreated if it exists already. It was thus a bit confusing to see my existing environment recreated sometimes nonetheless. For example it happens if I run Tox from the command line, and subsequently in Pycharm via Tox configuration (same configuration).

After some debugging, I discovered that I need to run tox with the python executable that initially created my environment in order to avoid recreating it. The environment path appears to be defined in the .tox-config1 file.
In my example above, Pycharm automatically activates the executable called pythonX.X in its command line tool, while it uses the executable called python when you run it via a Tox configuration.

What's the rationale behind ensuring that the same executable is used to prevent recreating an environment?
Additionally, I was wondering if it was possible to add a line or two in the documentation of the recreate config field to explain that false does not mean that the environment will not be recreated (for example if tox is called from another python)?

I use tox 3.12.1

Thank you,

PJ

@PJCampi PJCampi added the bug:normal affects many people or has quite an impact label Jul 20, 2019
@obestwalter
Copy link
Member

obestwalter commented Jul 20, 2019

Thanks for the report - tox has several ways trying to figure out, if it is necessary to recreate the environment, so setting recreate to false basically just means preserve the default behaviour (which is let tox guess if it should recreate the environment). Whereas set to true it actually means always force recreation. Im hindsight, maybe that flag would better have been called --force-recreate or something.

I was wondering if it was possible to add a line or two in the documentation of the recreate config field to explain that false does not mean that the environment will not be recreated (for example if tox is called from another python)?

Definitely. Go for it 🚀

@PJCampi
Copy link
Author

PJCampi commented Aug 18, 2019

I have updated the docs now. Can you let me know if something else needs to be done before the PR can be merged? I am pretty new at this.

gaborbernat pushed a commit that referenced this issue Aug 18, 2019
* clarify behaviour if recreate is set to false in config.rst (#1372)

* added file to changelog (#1372)

* add new line at the end of changelog entry (#1372)
@PJCampi PJCampi closed this as completed Aug 18, 2019
@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:documentation bug:normal affects many people or has quite an impact
Projects
None yet
Development

No branches or pull requests

2 participants