You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was giving a training today and I wanted to show how nox can be configured to reuse existing virtual environments.
This is what I wrote in noxfile.py :
nox.options.reuse_venv=True
Unfortunately nox does not raise any error and continues to run ! I did not realize it but if you look carefully it actually tells us that it (re)creates the env :
This is the correct way to tell nox to reuse virtual environments for all sessions :
nox.options.reuse_existing_virtualenvs=True
And we can check it that way
Expected Behavior
I would expect that an unsupported option in noxfile.py
nox.options.reuse_venv=True
would raise an error when running nox
Steps To Reproduce
see above
Environment
- OS: Windows 10
- Python: 3.11.4
- Nox: 2024.4.15
smarie
changed the title
Nox does not raise an error when wrong option is set
Nox does not raise an error when wrong option is set: reuse_venv Oct 18, 2024
smarie
changed the title
Nox does not raise an error when wrong option is set: reuse_venv
Nox does not raise an error when wrong option is set: reuse_venvOct 18, 2024
reuse_venv is actually a valid nox.options value. You are correct, though, that any invalid assignment is ignored - this has bugged me before. I've opened a PR.
In your case, reuse_venv takes a string: no, yes, never, and always. A second followup (more invasive, though) could be to validate these, say using attrs. A simpler fix just for this one would be to error if it's not set to one of those four strings.
Current Behavior
I was giving a training today and I wanted to show how nox can be configured to reuse existing virtual environments.
This is what I wrote in
noxfile.py
:Unfortunately nox does not raise any error and continues to run ! I did not realize it but if you look carefully it actually tells us that it (re)creates the env :
This is the correct way to tell nox to reuse virtual environments for all sessions :
And we can check it that way
Expected Behavior
I would expect that an unsupported option in noxfile.py
would raise an error when running nox
Steps To Reproduce
see above
Environment
Anything else?
See #488 for related recent PR
The text was updated successfully, but these errors were encountered: