##// END OF EJS Templates
teardown changes to sys.path
Thomas Kluyver -
Show More
@@ -43,7 +43,6 b' TMP_TEST_DIR = tempfile.mkdtemp()'
43 43 #
44 44
45 45 old_syspath = sys.path
46 sys.path = [TMP_TEST_DIR]
47 46
48 47 def make_empty_file(fname):
49 48 f = open(fname, 'w')
@@ -62,16 +61,19 b' def setup():'
62 61 make_empty_file(join(TMP_TEST_DIR, "xmod/sub.py"))
63 62 make_empty_file(join(TMP_TEST_DIR, "pack.py"))
64 63 make_empty_file(join(TMP_TEST_DIR, "packpyc.pyc"))
64 sys.path = [TMP_TEST_DIR]
65 65
66 66 def teardown():
67 67 """Teardown testenvironment for the module:
68 68
69 69 - Remove tempdir
70 - restore sys.path
70 71 """
71 72 # Note: we remove the parent test dir, which is the root of all test
72 73 # subdirs we may have created. Use shutil instead of os.removedirs, so
73 74 # that non-empty directories are all recursively removed.
74 75 shutil.rmtree(TMP_TEST_DIR)
76 sys.path = old_syspath
75 77
76 78
77 79 def test_get_init_1():
General Comments 0
You need to be logged in to leave comments. Login now