##// END OF EJS Templates
Fake _winreg in tests for non windows platforms
Jorgen Stenarson -
Show More
@@ -28,7 +28,12 b' from os.path import join, abspath'
28 try:
28 try:
29 import _winreg as wreg
29 import _winreg as wreg
30 except ImportError:
30 except ImportError:
31 pass
31 #Fake _winreg module on none windows platforms
32 import new
33 sys.modules["_winreg"]=new.module("_winreg")
34 import _winreg as wreg
35 #Add entries that needs to be stubbed by the testing code
36 (wreg.OpenKey, wreg.QueryValueEx,) = (None, None)
32
37
33 skip_if_not_win32 = skipif(sys.platform!='win32',"This test only runs under Windows")
38 skip_if_not_win32 = skipif(sys.platform!='win32',"This test only runs under Windows")
34
39
@@ -55,6 +60,9 b' def teardown_environment():'
55
60
56 with_enivronment=with_setup(setup_environment, teardown_environment)
61 with_enivronment=with_setup(setup_environment, teardown_environment)
57
62
63
64
65
58 @with_enivronment
66 @with_enivronment
59 def test_get_home_dir_1():
67 def test_get_home_dir_1():
60 """Testcase to see if we can call get_home_dir without Exceptions."""
68 """Testcase to see if we can call get_home_dir without Exceptions."""
@@ -130,8 +138,6 b' def test_get_home_dir_8():'
130 home_dir = genutils.get_home_dir()
138 home_dir = genutils.get_home_dir()
131 assert home_dir==abspath(join(".", "home_test_dir"))
139 assert home_dir==abspath(join(".", "home_test_dir"))
132
140
133
134
135 # Should we stub wreg fully so we can run the test on all platforms?
141 # Should we stub wreg fully so we can run the test on all platforms?
136 @skip_if_not_win32
142 @skip_if_not_win32
137 @with_enivronment
143 @with_enivronment
@@ -193,7 +199,6 b' def test_get_ipython_dir_4():'
193 assert ipdir == os.path.abspath(os.path.join("someplace", "_ipython"))
199 assert ipdir == os.path.abspath(os.path.join("someplace", "_ipython"))
194
200
195
201
196
197 #
202 #
198 # Tests for get_security_dir
203 # Tests for get_security_dir
199 #
204 #
@@ -204,8 +209,9 b' def test_get_security_dir():'
204 sdir = genutils.get_security_dir()
209 sdir = genutils.get_security_dir()
205
210
206
211
207
212 #
208
213 # Tests for popkey
214 #
209
215
210 def test_popkey_1():
216 def test_popkey_1():
211 dct=dict(a=1, b=2, c=3)
217 dct=dict(a=1, b=2, c=3)
General Comments 0
You need to be logged in to leave comments. Login now