[pypy-commit] pypy default: random test fixes for windows

mattip noreply at buildbot.pypy.org
Mon Feb 10 21:29:42 CET 2014


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r69119:5a5b32cdebb3
Date: 2014-02-10 22:28 +0200
http://bitbucket.org/pypy/pypy/changeset/5a5b32cdebb3/

Log:	random test fixes for windows

diff --git a/rpython/translator/c/test/test_extfunc.py b/rpython/translator/c/test/test_extfunc.py
--- a/rpython/translator/c/test/test_extfunc.py
+++ b/rpython/translator/c/test/test_extfunc.py
@@ -65,7 +65,8 @@
 
     f1 = compile(does_stuff, [])
     f1()
-    assert open(filename, 'r').read() == "hello world\n"
+    with open(filename, 'r') as fid:
+        assert fid.read() == "hello world\n"
     os.unlink(filename)
 
 def test_big_read():
@@ -296,8 +297,10 @@
         os.chdir(path)
         return os.getcwd()
     f1 = compile(does_stuff, [str])
-    # different on windows please
-    assert f1('/tmp') == os.path.realpath('/tmp')
+    if os.name == 'nt':
+        assert f1(os.environment['TEMP']) == os.path.realpath(os.environment['TEMP'])
+    else:    
+        assert f1('/tmp') == os.path.realpath('/tmp')
 
 def test_mkdir_rmdir():
     def does_stuff(path, delete):
diff --git a/rpython/translator/c/test/test_newgc.py b/rpython/translator/c/test/test_newgc.py
--- a/rpython/translator/c/test/test_newgc.py
+++ b/rpython/translator/c/test/test_newgc.py
@@ -658,7 +658,8 @@
 
     def test_open_read_write_seek_close(self):
         self.run('open_read_write_seek_close')
-        assert open(self.filename, 'r').read() == "hello world\n"
+        with open(self.filename, 'r') as fid:
+            assert fid.read() == "hello world\n"
         os.unlink(self.filename)
 
     def define_callback_with_collect(cls):


More information about the pypy-commit mailing list