Skip to content
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

fix: support changing directory with TMPDIR #556

Merged
merged 1 commit into from Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion nox/sessions.py
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
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