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