Show More
@@ -20,10 +20,10 b' from IPython.testing.decorators import skipif' | |||
|
20 | 20 | from nose import with_setup |
|
21 | 21 | from nose.tools import raises |
|
22 | 22 | |
|
23 | from os.path import join, abspath, split | |
|
23 | 24 | import os, sys, IPython |
|
24 | env = os.environ | |
|
25 | 25 | |
|
26 | from os.path import join, abspath, split | |
|
26 | env = os.environ | |
|
27 | 27 | |
|
28 | 28 | try: |
|
29 | 29 | import _winreg as wreg |
@@ -78,7 +78,7 b' def test_get_home_dir_1():' | |||
|
78 | 78 | def test_get_home_dir_2(): |
|
79 | 79 | """Testcase for py2exe logic, compressed lib |
|
80 | 80 | """ |
|
81 | sys.frozen=True | |
|
81 | sys.frozen = True | |
|
82 | 82 | #fake filename for IPython.__init__ |
|
83 | 83 | IPython.__file__ = abspath(join(test_file_path, "home_test_dir/Library.zip/IPython/__init__.py")) |
|
84 | 84 | |
@@ -88,7 +88,7 b' def test_get_home_dir_2():' | |||
|
88 | 88 | @with_enivronment |
|
89 | 89 | def test_get_home_dir_3(): |
|
90 | 90 | """Testcase $HOME is set, then use its value as home directory.""" |
|
91 | env["HOME"] = join(test_file_path,"home_test_dir") | |
|
91 | env["HOME"] = join(test_file_path, "home_test_dir") | |
|
92 | 92 | home_dir = genutils.get_home_dir() |
|
93 | 93 | assert home_dir == env["HOME"] |
|
94 | 94 | |
@@ -112,7 +112,7 b' def test_get_home_dir_5():' | |||
|
112 | 112 | |
|
113 | 113 | os.name = 'nt' |
|
114 | 114 | del os.environ["HOME"] |
|
115 | env['HOMEDRIVE'],env['HOMEPATH'] = os.path.abspath(test_file_path),"home_test_dir" | |
|
115 | env['HOMEDRIVE'], env['HOMEPATH'] = os.path.abspath(test_file_path), "home_test_dir" | |
|
116 | 116 | |
|
117 | 117 | home_dir = genutils.get_home_dir() |
|
118 | 118 | assert home_dir == abspath(join(test_file_path, "home_test_dir")) |
@@ -126,8 +126,8 b' def test_get_home_dir_6():' | |||
|
126 | 126 | |
|
127 | 127 | os.name = 'nt' |
|
128 | 128 | del os.environ["HOME"] |
|
129 | env['HOMEDRIVE'],env['HOMEPATH'] = os.path.abspath(test_file_path),"DOES NOT EXIST" | |
|
130 | env["USERPROFILE"] = abspath(join(test_file_path,"home_test_dir")) | |
|
129 | env['HOMEDRIVE'], env['HOMEPATH'] = os.path.abspath(test_file_path), "DOES NOT EXIST" | |
|
130 | env["USERPROFILE"] = abspath(join(test_file_path, "home_test_dir")) | |
|
131 | 131 | |
|
132 | 132 | home_dir = genutils.get_home_dir() |
|
133 | 133 | assert home_dir == abspath(join(test_file_path, "home_test_dir")) |
@@ -140,7 +140,7 b' def test_get_home_dir_7():' | |||
|
140 | 140 | env['HOMEDRIVE'],env['HOMEPATH'], env['USERPROFILE'] missing |
|
141 | 141 | """ |
|
142 | 142 | os.name = 'nt' |
|
143 | del env["HOME"],env['HOMEDRIVE'] | |
|
143 | del env["HOME"], env['HOMEDRIVE'] | |
|
144 | 144 | |
|
145 | 145 | #Stub windows registry functions |
|
146 | 146 | def OpenKey(x, y): |
@@ -173,7 +173,7 b' def test_get_ipython_dir_1():' | |||
|
173 | 173 | @with_enivronment |
|
174 | 174 | def test_get_ipython_dir_2(): |
|
175 | 175 | """3 Testcase to see if we can call get_ipython_dir without Exceptions.""" |
|
176 | genutils.get_home_dir=lambda : "someplace" | |
|
176 | genutils.get_home_dir = lambda : "someplace" | |
|
177 | 177 | os.name = "posix" |
|
178 | 178 | ipdir = genutils.get_ipython_dir() |
|
179 | 179 | assert ipdir == os.path.abspath(os.path.join("someplace", ".ipython")) |
@@ -217,15 +217,15 b' def test_popkey_2():' | |||
|
217 | 217 | |
|
218 | 218 | def test_popkey_3(): |
|
219 | 219 | dct = dict(a=1, b=2, c=3) |
|
220 | assert genutils.popkey(dct, "A", 13)==13 | |
|
220 | assert genutils.popkey(dct, "A", 13) == 13 | |
|
221 | 221 | assert dct == dict(a=1, b=2, c=3) |
|
222 | assert genutils.popkey(dct, "B", 14)==14 | |
|
222 | assert genutils.popkey(dct, "B", 14) == 14 | |
|
223 | 223 | assert dct == dict(a=1, b=2, c=3) |
|
224 | assert genutils.popkey(dct, "C", 15)==15 | |
|
224 | assert genutils.popkey(dct, "C", 15) == 15 | |
|
225 | 225 | assert dct == dict(a=1, b=2, c=3) |
|
226 | assert genutils.popkey(dct, "a")==1 | |
|
226 | assert genutils.popkey(dct, "a") == 1 | |
|
227 | 227 | assert dct == dict(b=2, c=3) |
|
228 | assert genutils.popkey(dct, "b")==2 | |
|
228 | assert genutils.popkey(dct, "b") == 2 | |
|
229 | 229 | assert dct == dict(c=3) |
|
230 | assert genutils.popkey(dct, "c")==3 | |
|
230 | assert genutils.popkey(dct, "c") == 3 | |
|
231 | 231 | assert dct == dict() |
General Comments 0
You need to be logged in to leave comments.
Login now