Show More
@@ -25,6 +25,8 from IPython.testing.tools import make_tempfile | |||||
25 |
|
25 | |||
26 | import IPython.utils.module_paths as mp |
|
26 | import IPython.utils.module_paths as mp | |
27 |
|
27 | |||
|
28 | import nose.tools as nt | |||
|
29 | ||||
28 | env = os.environ |
|
30 | env = os.environ | |
29 | TEST_FILE_PATH = split(abspath(__file__))[0] |
|
31 | TEST_FILE_PATH = split(abspath(__file__))[0] | |
30 | TMP_TEST_DIR = tempfile.mkdtemp() |
|
32 | TMP_TEST_DIR = tempfile.mkdtemp() | |
@@ -79,47 +81,47 def test_get_init_2(): | |||||
79 | def test_get_init_3(): |
|
81 | def test_get_init_3(): | |
80 | """get_init can't find __init__.pyc in this testdir""" |
|
82 | """get_init can't find __init__.pyc in this testdir""" | |
81 | with make_tempfile(join(TMP_TEST_DIR, "__init__.pyc")): |
|
83 | with make_tempfile(join(TMP_TEST_DIR, "__init__.pyc")): | |
82 |
assert |
|
84 | nt.assert_is_none(mp.get_init(TMP_TEST_DIR)) | |
83 |
|
85 | |||
84 | def test_get_init_4(): |
|
86 | def test_get_init_4(): | |
85 | """get_init can't find __init__ in empty testdir""" |
|
87 | """get_init can't find __init__ in empty testdir""" | |
86 |
assert |
|
88 | nt.assert_is_none(mp.get_init(TMP_TEST_DIR)) | |
87 |
|
89 | |||
88 |
|
90 | |||
89 | def test_find_mod_1(): |
|
91 | def test_find_mod_1(): | |
90 | modpath = join(TMP_TEST_DIR, "xmod", "__init__.py") |
|
92 | modpath = join(TMP_TEST_DIR, "xmod", "__init__.py") | |
91 |
assert |
|
93 | nt.assert_equal(mp.find_mod("xmod"), modpath) | |
92 |
|
94 | |||
93 | def test_find_mod_2(): |
|
95 | def test_find_mod_2(): | |
94 | modpath = join(TMP_TEST_DIR, "xmod", "__init__.py") |
|
96 | modpath = join(TMP_TEST_DIR, "xmod", "__init__.py") | |
95 |
assert |
|
97 | nt.assert_equal(mp.find_mod("xmod"), modpath) | |
96 |
|
98 | |||
97 | def test_find_mod_3(): |
|
99 | def test_find_mod_3(): | |
98 | modpath = join(TMP_TEST_DIR, "xmod", "sub.py") |
|
100 | modpath = join(TMP_TEST_DIR, "xmod", "sub.py") | |
99 |
assert |
|
101 | nt.assert_equal(mp.find_mod("xmod.sub"), modpath) | |
100 |
|
102 | |||
101 | def test_find_mod_4(): |
|
103 | def test_find_mod_4(): | |
102 | modpath = join(TMP_TEST_DIR, "pack.py") |
|
104 | modpath = join(TMP_TEST_DIR, "pack.py") | |
103 |
assert |
|
105 | nt.assert_equal(mp.find_mod("pack"), modpath) | |
104 |
|
106 | |||
105 | def test_find_mod_5(): |
|
107 | def test_find_mod_5(): | |
106 |
assert |
|
108 | nt.assert_is_none(mp.find_mod("packpyc")) | |
107 |
|
109 | |||
108 | def test_find_module_1(): |
|
110 | def test_find_module_1(): | |
109 | modpath = join(TMP_TEST_DIR, "xmod") |
|
111 | modpath = join(TMP_TEST_DIR, "xmod") | |
110 |
assert |
|
112 | nt.assert_equal(mp.find_module("xmod"), modpath) | |
111 |
|
113 | |||
112 | def test_find_module_2(): |
|
114 | def test_find_module_2(): | |
113 | """Testing sys.path that is empty""" |
|
115 | """Testing sys.path that is empty""" | |
114 |
assert |
|
116 | nt.assert_is_none(mp.find_module("xmod", [])) | |
115 |
|
117 | |||
116 | def test_find_module_3(): |
|
118 | def test_find_module_3(): | |
117 | """Testing sys.path that is empty""" |
|
119 | """Testing sys.path that is empty""" | |
118 |
assert |
|
120 | nt.assert_is_none(mp.find_module(None, None)) | |
119 |
|
121 | |||
120 | def test_find_module_4(): |
|
122 | def test_find_module_4(): | |
121 | """Testing sys.path that is empty""" |
|
123 | """Testing sys.path that is empty""" | |
122 |
assert |
|
124 | nt.assert_is_none(mp.find_module(None)) | |
123 |
|
125 | |||
124 | def test_find_module_5(): |
|
126 | def test_find_module_5(): | |
125 |
assert |
|
127 | nt.assert_is_none(mp.find_module("xmod.nopack")) |
General Comments 0
You need to be logged in to leave comments.
Login now