##// END OF EJS Templates
Various fixes for IPython.core tests to pass under win32.
Fernando Perez -
r2446:d277b37c
parent child
Show More
@@ -141,7 +141,12 class TestMagicRunSimple(tt.TempFileMixin):
141 _ip.magic('run "%s"' % self.fname)
141 _ip.magic('run "%s"' % self.fname)
142 _ip.runlines('t = isinstance(f(), foo)')
142 _ip.runlines('t = isinstance(f(), foo)')
143 nt.assert_true(_ip.user_ns['t'])
143 nt.assert_true(_ip.user_ns['t'])
144
144
145 # We have to skip these in win32 because genutils.getoutputerr() crashes,
146 # due to the fact that subprocess does not support close_fds when
147 # redirecting stdout/err. So unless someone who knows more tells us how to
148 # implement genutils.getoutputerr() in win32, we're stuck avoiding these.
149 @dec.skip_win32
145 def test_obj_del(self):
150 def test_obj_del(self):
146 """Test that object's __del__ methods are called on exit."""
151 """Test that object's __del__ methods are called on exit."""
147
152
@@ -154,6 +159,7 class TestMagicRunSimple(tt.TempFileMixin):
154 self.mktmp(src)
159 self.mktmp(src)
155 tt.ipexec_validate(self.fname, 'object A deleted')
160 tt.ipexec_validate(self.fname, 'object A deleted')
156
161
162 @dec.skip_win32
157 def test_tclass(self):
163 def test_tclass(self):
158 mydir = os.path.dirname(__file__)
164 mydir = os.path.dirname(__file__)
159 tc = os.path.join(mydir, 'tclass')
165 tc = os.path.join(mydir, 'tclass')
@@ -174,7 +174,7 def default_argv():
174 ipcdir = os.path.dirname(default.__file__)
174 ipcdir = os.path.dirname(default.__file__)
175 ipconf = os.path.join(ipcdir,'ipython_config.py')
175 ipconf = os.path.join(ipcdir,'ipython_config.py')
176 return ['--colors=NoColor', '--no-term-title','--no-banner',
176 return ['--colors=NoColor', '--no-term-title','--no-banner',
177 '--config-file=%s' % ipconf, '--autocall=0',
177 '--config-file="%s"' % ipconf, '--autocall=0',
178 '--prompt-out=""']
178 '--prompt-out=""']
179
179
180
180
@@ -203,9 +203,14 def ipexec(fname, options=None):
203
203
204 _ip = get_ipython()
204 _ip = get_ipython()
205 test_dir = os.path.dirname(__file__)
205 test_dir = os.path.dirname(__file__)
206 # Find the ipython script from the package we're using, so that the test
207 # suite can be run from the source tree without an installed IPython
208 ipython_package_dir = genutils.get_ipython_package_dir()
209 ipython_script = os.path.join(ipython_package_dir,'scripts','ipython')
210 ipython_cmd = 'python "%s"' % ipython_script
211 # Absolute path for filename
206 full_fname = os.path.join(test_dir, fname)
212 full_fname = os.path.join(test_dir, fname)
207 ipython_cmd = platutils.find_cmd('ipython')
213 full_cmd = '%s %s "%s"' % (ipython_cmd, cmdargs, full_fname)
208 full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname)
209 return genutils.getoutputerror(full_cmd)
214 return genutils.getoutputerror(full_cmd)
210
215
211
216
@@ -256,11 +261,14 class TempFileMixin(object):
256 self.fname = fname
261 self.fname = fname
257
262
258 def teardown(self):
263 def teardown(self):
259 self.tmpfile.close()
264 if hasattr(self, 'tmpfile'):
260 try:
265 # If the tmpfile wasn't made because of skipped tests, like in
261 os.unlink(self.fname)
266 # win32, there's nothing to cleanup.
262 except:
267 self.tmpfile.close()
263 # On Windows, even though we close the file, we still can't delete
268 try:
264 # it. I have no clue why
269 os.unlink(self.fname)
265 pass
270 except:
271 # On Windows, even though we close the file, we still can't
272 # delete it. I have no clue why
273 pass
266
274
General Comments 0
You need to be logged in to leave comments. Login now