diff --git a/apptools/persistence/tests/test_file_path.py b/apptools/persistence/tests/test_file_path.py index 3c15bcfff..d70d40f97 100644 --- a/apptools/persistence/tests/test_file_path.py +++ b/apptools/persistence/tests/test_file_path.py @@ -12,16 +12,30 @@ from os.path import abspath, dirname, basename, join from io import BytesIO +# 3rd party imports. +import pkg_resources + # Enthought library imports. from apptools.persistence import state_pickler from apptools.persistence import file_path + class Test: def __init__(self): self.f = file_path.FilePath() class TestFilePath(unittest.TestCase): + def setUp(self): + # If the cwd is somewhere under /tmp, that confuses the tests below. + # Use the directory containing this file, instead. + test_cwd = pkg_resources.resource_filename("apptools.persistence", "") + self.old_cwd = os.getcwd() + os.chdir(test_cwd) + + def tearDown(self): + os.chdir(self.old_cwd) + def test_relative(self): """Test if relative paths are set correctly. """