Skip to content

Commit

Permalink
toxworkdir: use realpath
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Feb 22, 2019
1 parent 44867b8 commit ea9e20a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,9 @@ def __init__(self, config, ini_path, ini_data): # noqa
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)

if os.path.exists(str(config.toxworkdir)):
config.toxworkdir = config.toxworkdir.realpath()

if config.option.skip_missing_interpreters == "config":
val = reader.getbool("skip_missing_interpreters", False)
config.option.skip_missing_interpreters = "true" if val else "false"
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@ def test_explicit_config_path(self, tmpdir):
config = parseconfig(["-c", str(path)])
assert config.toxinipath == config_file_path

@pytest.mark.skipif(sys.platform == "win32", reason="no symlinks on Windows")
def test_workdir_gets_resolved(self, tmpdir):
"""
Test explicitly setting config path, both with and without the filename
"""
real = tmpdir.mkdir("real")
symlink = tmpdir.join("link")
symlink.mksymlinkto(real)

config = parseconfig(["--workdir", str(symlink)])
assert config.toxworkdir == real


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

0 comments on commit ea9e20a

Please sign in to comment.