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):