-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Regression: specifying workdir is treated like root #2713
Comments
This tox file runs successfully and illustrates how the issue is new with tox 4:
|
Feel free to submit a PR to address this 👍 |
@jaraco the environment is getting created but in a different location: ls .tox/.tox/child |
I suspect the following lines are related (where Lines 191 to 192 in b8b0803
My guess is the appending happens in the parent tox env, and then sets an env var, and then the child invocation adds it again. Possibly related: #2654 |
Also possibly related: #2473 |
I figured out this fixes it: tox main $ git diff
diff --git a/src/tox/config/sets.py b/src/tox/config/sets.py
index e07f4bd4..cdacebfc 100644
--- a/src/tox/config/sets.py
+++ b/src/tox/config/sets.py
@@ -189,7 +189,7 @@ class CoreConfigSet(ConfigSet):
)
def work_dir_builder(conf: Config, env_name: str | None) -> Path: # noqa: U100
- return (conf.work_dir if conf.work_dir is not None else cast(Path, self["tox_root"])) / ".tox"
+ return conf.work_dir if conf.work_dir is not None else cast(Path, self["tox_root"]) / ".tox"
self.add_config(
keys=["work_dir", "toxworkdir"], |
Unfortunately, I also get 4 new test failures when applying that patch, none of which are failing for reasons I can readily understand. |
According to the docs, But the help tells a different story:
|
The bug is in the help message. |
It took me a while to trace, but I found where Lines 93 to 94 in 12f6268
The only reason that didn't cause problems was because Lines 191 to 192 in 12f6268
|
Indeed, this issue is more serious than just with nested environments. Any environment that passes workdir fails by putting an extra
|
I applied this diff and no new tests fail: diff --git a/src/tox/config/sets.py b/src/tox/config/sets.py
index e07f4bd4..49625763 100644
--- a/src/tox/config/sets.py
+++ b/src/tox/config/sets.py
@@ -189,6 +189,7 @@ class CoreConfigSet(ConfigSet):
)
def work_dir_builder(conf: Config, env_name: str | None) -> Path: # noqa: U100
+ assert conf.work_dir is not None
return (conf.work_dir if conf.work_dir is not None else cast(Path, self["tox_root"])) / ".tox"
self.add_config( That means that the resolution of the work dir relative to the root is never used. |
Indeed, this issue is just a dupe of #2654. |
In pypa/twine#684 (comment), we learned that since tox 4, invoking tox from a tox environment fails to create the environment. Here's a minimal reproducer:
I suspect one or more of the environment variables supplied in the parent env are affecting the invocation of tox and preventing the child env from being created.
The text was updated successfully, but these errors were encountered: