From e70ac56d86d9b8ab08e408b2579bef82f31d7a49 2013-07-31 01:32:28 From: Paul Ivanov Date: 2013-07-31 01:32:28 Subject: [PATCH] test for TemporaryWorkingDirectory --- diff --git a/IPython/utils/tests/test_tempdir.py b/IPython/utils/tests/test_tempdir.py index 8e919e5..acb6a66 100644 --- a/IPython/utils/tests/test_tempdir.py +++ b/IPython/utils/tests/test_tempdir.py @@ -8,6 +8,7 @@ import os from IPython.utils.tempdir import NamedFileInTemporaryDirectory +from IPython.utils.tempdir import TemporaryWorkingDirectory def test_named_file_in_temporary_directory(): @@ -18,3 +19,10 @@ def test_named_file_in_temporary_directory(): file.write(b'test') assert file.closed assert not os.path.exists(name) + +def test_temporary_working_directory(): + with TemporaryWorkingDirectory() as dir: + assert os.path.exists(dir) + assert os.path.abspath(os.curdir) == dir + assert not os.path.exists(dir) + assert os.path.abspath(os.curdir) != dir