[pypy-commit] pypy win64-stage1: Merge with default

ctismer noreply at buildbot.pypy.org
Tue Nov 29 23:29:22 CET 2011


Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r49981:f16c55f8b3e5
Date: 2011-11-29 21:39 +0100
http://bitbucket.org/pypy/pypy/changeset/f16c55f8b3e5/

Log:	Merge with default

diff --git a/pypy/tool/nullpath.py b/pypy/tool/nullpath.py
--- a/pypy/tool/nullpath.py
+++ b/pypy/tool/nullpath.py
@@ -1,4 +1,9 @@
-import py
+import py, os
+
+if os.name <> 'nt':
+    NULLPATHNAME = '/dev/null'
+else:
+    NULLPATHNAME = 'NUL'
 
 class NullPyPathLocal(py.path.local):
 
@@ -6,7 +11,7 @@
         return self.__class__(py.path.local.join(self, *args))
 
     def open(self, mode):
-        return open('/dev/null', mode)
+        return open(NULLPATHNAME, mode)
 
     def __repr__(self):
         return py.path.local.__repr__(self) + ' [fake]'
diff --git a/pypy/tool/test/test_nullpath.py b/pypy/tool/test/test_nullpath.py
--- a/pypy/tool/test/test_nullpath.py
+++ b/pypy/tool/test/test_nullpath.py
@@ -1,10 +1,7 @@
 import sys
 import py
-from pypy.tool.nullpath import NullPyPathLocal
+from pypy.tool.nullpath import NullPyPathLocal, NULLPATHNAME
 
-def setup_module():
-    if 'posix' not in sys.builtin_module_names:
-        py.test.skip('posix only')
 
 def test_nullpath(tmpdir):
     path = NullPyPathLocal(tmpdir)
@@ -13,4 +10,4 @@
     assert isinstance(foo_txt, NullPyPathLocal)
     #
     f = foo_txt.open('w')
-    assert f.name == '/dev/null'
+    assert f.name == NULLPATHNAME


More information about the pypy-commit mailing list