Skip to content

Commit

Permalink
fix: support changing directory with TMPDIR (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii authored Jan 7, 2022
1 parent 8261d2a commit 4eb9de5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def create_tmp(self) -> str:
"""Create, and return, a temporary directory."""
tmpdir = os.path.join(self._runner.envdir, "tmp")
os.makedirs(tmpdir, exist_ok=True)
self.env["TMPDIR"] = tmpdir
self.env["TMPDIR"] = os.path.abspath(tmpdir)
return tmpdir

@property
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_create_tmp(self):
with tempfile.TemporaryDirectory() as root:
runner.global_config.envdir = root
tmpdir = session.create_tmp()
assert session.env["TMPDIR"] == tmpdir
assert session.env["TMPDIR"] == os.path.abspath(tmpdir)
assert tmpdir.startswith(root)

def test_create_tmp_twice(self):
Expand All @@ -94,7 +94,7 @@ def test_create_tmp_twice(self):
runner.venv.bin = bin
session.create_tmp()
tmpdir = session.create_tmp()
assert session.env["TMPDIR"] == tmpdir
assert session.env["TMPDIR"] == os.path.abspath(tmpdir)
assert tmpdir.startswith(root)

def test_properties(self):
Expand Down

0 comments on commit 4eb9de5

Please sign in to comment.