1. Pypy
  2. Untitled project
  3. pypy

Commits

mattip  committed 5a5b32c

random test fixes for windows

  • Participants
  • Parent commits 2c9c60b
  • Branches default

Comments (0)

Files changed (2)

File rpython/translator/c/test/test_extfunc.py

View file
 
     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():
         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):

File rpython/translator/c/test/test_newgc.py

View file
 
     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):