Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix change_dir is not always relative to tox_root
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
- Loading branch information
1 parent
a26b975
commit 50c57b0
Showing
7 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix :ref:`change_dir` is relative to current working directory rather than to the :ref:`tox_root` when using the ``-c`` | ||
argument to locate the ``tox.ini`` file - by :user:`gaborbernat`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from __future__ import annotations | ||
|
||
from functools import partial | ||
from pathlib import Path | ||
from typing import cast | ||
|
||
from tox.config.sets import CoreConfigSet, EnvConfigSet | ||
|
||
|
||
def add_change_dir_conf(config: EnvConfigSet, core: CoreConfigSet) -> None: | ||
config.add_config( | ||
keys=["change_dir", "changedir"], | ||
of_type=Path, | ||
default=lambda conf, name: cast(Path, conf.core["tox_root"]), # noqa: U100 | ||
desc="change to this working directory when executing the test command", | ||
post_process=partial(_post_process_change_dir, core), | ||
) | ||
|
||
|
||
def _post_process_change_dir(core: CoreConfigSet, value: Path) -> None: | ||
if not value.is_absolute(): | ||
value = (core["tox_root"] / value).resolve() | ||
return value | ||
|
||
|
||
__all__ = [ | ||
"add_change_dir_conf", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters