Skip to content

Commit 76f873e

Browse files
committed
toxworkdir: use realpath
Fixes tox-dev#1169.
1 parent 44867b8 commit 76f873e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/tox/config/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,9 @@ def __init__(self, config, ini_path, ini_data): # noqa
999999
else:
10001000
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
10011001

1002+
if os.path.exists(str(config.toxworkdir)):
1003+
config.toxworkdir = config.toxworkdir.realpath()
1004+
10021005
if config.option.skip_missing_interpreters == "config":
10031006
val = reader.getbool("skip_missing_interpreters", False)
10041007
config.option.skip_missing_interpreters = "true" if val else "false"

tests/unit/config/test_config.py

+12
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ def test_explicit_config_path(self, tmpdir):
279279
config = parseconfig(["-c", str(path)])
280280
assert config.toxinipath == config_file_path
281281

282+
@pytest.mark.skipif(sys.platform == "win32", reason="no symlinks on Windows")
283+
def test_workdir_gets_resolved(self, tmpdir):
284+
"""
285+
Test explicitly setting config path, both with and without the filename
286+
"""
287+
real = tmpdir.mkdir("real")
288+
symlink = tmpdir.join("link")
289+
symlink.mksymlinkto(real)
290+
291+
config = parseconfig(["--workdir", str(symlink)])
292+
assert config.toxworkdir == real
293+
282294

283295
def test_get_homedir(monkeypatch):
284296
monkeypatch.setattr(py.path.local, "_gethomedir", classmethod(lambda x: {}[1]))

0 commit comments

Comments
 (0)