From 4a06baffc7761e45ab5f9205a14be5857d204d05 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 6 Jan 2022 00:14:58 -0500 Subject: [PATCH] fix: support changing directory with TMPDIR --- nox/sessions.py | 2 +- tests/test_sessions.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nox/sessions.py b/nox/sessions.py index a71b6789..a1693966 100644 --- a/nox/sessions.py +++ b/nox/sessions.py @@ -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 diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 262d9f32..a90aa687 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -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): @@ -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):