[pypy-svn] r53729 - pypy/branch/io-improvements/pypy/translator/c/test

fijal at codespeak.net fijal at codespeak.net
Sat Apr 12 19:04:34 CEST 2008


Author: fijal
Date: Sat Apr 12 19:04:34 2008
New Revision: 53729

Modified:
   pypy/branch/io-improvements/pypy/translator/c/test/test_extfunc.py
   pypy/branch/io-improvements/pypy/translator/c/test/test_newgc.py
Log:
move this test to test_newgc, now it's run against all gcs


Modified: pypy/branch/io-improvements/pypy/translator/c/test/test_extfunc.py
==============================================================================
--- pypy/branch/io-improvements/pypy/translator/c/test/test_extfunc.py	(original)
+++ pypy/branch/io-improvements/pypy/translator/c/test/test_extfunc.py	Sat Apr 12 19:04:34 2008
@@ -77,25 +77,6 @@
     assert open(filename, 'r').read() == "hello world\n"
     os.unlink(filename)
 
-def test_open_read_write_seek_close_moving():
-    filename = str(udir.join('test_open_read_write_close.txt'))
-    def does_stuff():
-        fd = os.open(filename, os.O_WRONLY | os.O_CREAT, 0777)
-        count = os.write(fd, "hello world\n")
-        assert count == len("hello world\n")
-        os.close(fd)
-        fd = os.open(filename, os.O_RDONLY, 0777)
-        result = os.lseek(fd, 1, 0)
-        assert result == 1
-        data = os.read(fd, 500)
-        assert data == "ello world\n"
-        os.close(fd)
-
-    f1 = compile(does_stuff, [], gcpolicy='semispace')
-    f1(expected_extra_mallocs=9)
-    assert open(filename, 'r').read() == "hello world\n"
-    os.unlink(filename)
-
 def test_big_read():
     filename = str(udir.join('test_open_read_write_close.txt'))
     def does_stuff():

Modified: pypy/branch/io-improvements/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/branch/io-improvements/pypy/translator/c/test/test_newgc.py	(original)
+++ pypy/branch/io-improvements/pypy/translator/c/test/test_newgc.py	Sat Apr 12 19:04:34 2008
@@ -2,6 +2,7 @@
 import sys
 import py
 from py.test import raises
+import os
 
 from pypy.objspace.flow.model import summary
 from pypy.translator.translator import TranslationContext
@@ -11,6 +12,7 @@
 from pypy.rpython.lltypesystem.lloperation import llop
 from pypy.rpython.memory.test import snippet
 from pypy import conftest
+from pypy.tool.udir import udir
 
 def compile_func(fn, inputtypes, t=None, gcpolicy="ref"):
     from pypy.config.pypyoption import get_pypy_config
@@ -813,6 +815,25 @@
         c_fn = self.getcompiled(f)
         assert c_fn() == 0
 
+    def test_open_read_write_seek_close(self):
+        filename = str(udir.join('test_open_read_write_close.txt'))
+        def does_stuff():
+            fd = os.open(filename, os.O_WRONLY | os.O_CREAT, 0777)
+            count = os.write(fd, "hello world\n")
+            assert count == len("hello world\n")
+            os.close(fd)
+            fd = os.open(filename, os.O_RDONLY, 0777)
+            result = os.lseek(fd, 1, 0)
+            assert result == 1
+            data = os.read(fd, 500)
+            assert data == "ello world\n"
+            os.close(fd)
+
+        f1 = self.getcompiled(does_stuff, [])
+        f1()
+        assert open(filename, 'r').read() == "hello world\n"
+        os.unlink(filename)
+
 
 class TestUsingStacklessFramework(TestUsingFramework):
 
@@ -840,6 +861,9 @@
     def test_weakref(self):
         py.test.skip("fails for some reason I couldn't figure out yet :-(")
 
+    def test_open_read_write_seek_close(self):
+        py.test.skip("str complaining")
+
 class TestSemiSpaceGC(TestUsingFramework, snippet.SemiSpaceGCTests):
     gcpolicy = "semispace"
     should_be_moving = True
@@ -895,7 +919,6 @@
         res = c_fn()
         assert res == 2
 
-
 class TestGenerationalGC(TestSemiSpaceGC):
     gcpolicy = "generation"
     should_be_moving = True



More information about the Pypy-commit mailing list