From bc8cfc4ccbcff84c045f5d150f4daceef3a547d5 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Mon, 9 Jul 2018 10:45:31 +0100 Subject: [PATCH] TEST: Another unit test for tempdir --- tests/test_tempdir.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_tempdir.py b/tests/test_tempdir.py index 0495deb03..920997965 100644 --- a/tests/test_tempdir.py +++ b/tests/test_tempdir.py @@ -51,3 +51,15 @@ def test_tempdir_changeto(): assert op.realpath(os.getcwd()) == cwd assert op.realpath(os.getcwd()) == cwd + + +def test_tempdir_override(): + with tempdir.tempdir() as parent: + + # tempdir should not create/change to + # a new temp directory, but should + # stay in the override directory + with tempdir.tempdir(override=parent): + assert op.realpath(os.getcwd()) == op.realpath(parent) + # override should not be deleted + assert op.exists(parent) -- GitLab