[pypy-svn] r49413 - pypy/branch/pypy-interp-file/module/_file/test

arigo at codespeak.net arigo at codespeak.net
Wed Dec 5 20:15:31 CET 2007


Author: arigo
Date: Wed Dec  5 20:15:31 2007
New Revision: 49413

Modified:
   pypy/branch/pypy-interp-file/module/_file/test/test_file_extra.py
Log:
Fix more tests.


Modified: pypy/branch/pypy-interp-file/module/_file/test/test_file_extra.py
==============================================================================
--- pypy/branch/pypy-interp-file/module/_file/test/test_file_extra.py	(original)
+++ pypy/branch/pypy-interp-file/module/_file/test/test_file_extra.py	Wed Dec  5 20:15:31 2007
@@ -260,14 +260,24 @@
     extra_args = ()
 
     def setup_method(self, method):
+        from pypy.module._file.interp_file import W_File
+        space = self.space
         O_BINARY = getattr(os, "O_BINARY", 0)
-        fd = os.open(TestFile.expected_filename, os.O_RDONLY | O_BINARY)
-        self.file = _file.file.fdopen(fd,
-                                      self.expected_mode,
-                                      *self.extra_args)
+        w_filetype = space.gettypeobject(W_File.typedef)
+        fd = os.open(AppTestFile.expected_filename, os.O_RDONLY | O_BINARY)
+        self.w_file = space.call_method(
+            w_filetype,
+            'fdopen',
+            space.wrap(fd),
+            space.wrap(self.expected_mode),
+            *[space.wrap(a) for a in self.extra_args])
+        self.w_sample = space.wrap(SAMPLE)
+        self.w_expected_filename = space.wrap(self.expected_filename)
+        self.w_expected_mode = space.wrap(self.expected_mode)
+        self.w_expected_lines = space.wrap(self.get_expected_lines())
 
     def teardown_method(self, method):
-        self.file.close()
+        self.space.call_method(self.w_file, 'close')
 
 
 class AppTestUnbufferedFdOpen(AppTestFdOpen):



More information about the Pypy-commit mailing list