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