[pypy-commit] pypy default: adjusted nullpath according to amaury's suggestion
ctismer
noreply at buildbot.pypy.org
Wed Nov 30 01:16:13 CET 2011
Author: Christian Tismer <tismer at stackless.com>
Branch:
Changeset: r49986:5c81dab4eeda
Date: 2011-11-30 01:11 +0100
http://bitbucket.org/pypy/pypy/changeset/5c81dab4eeda/
Log: adjusted nullpath according to amaury's suggestion
diff --git a/pypy/tool/nullpath.py b/pypy/tool/nullpath.py
--- a/pypy/tool/nullpath.py
+++ b/pypy/tool/nullpath.py
@@ -1,17 +1,12 @@
import py, os
-if os.name <> 'nt':
- NULLPATHNAME = '/dev/null'
-else:
- NULLPATHNAME = 'NUL'
-
class NullPyPathLocal(py.path.local):
def join(self, *args):
return self.__class__(py.path.local.join(self, *args))
def open(self, mode):
- return open(NULLPATHNAME, mode)
+ return open(os.devnull, 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,7 +1,6 @@
-import sys
+import sys, os
import py
-from pypy.tool.nullpath import NullPyPathLocal, NULLPATHNAME
-
+from pypy.tool.nullpath import NullPyPathLocal
def test_nullpath(tmpdir):
path = NullPyPathLocal(tmpdir)
@@ -10,4 +9,4 @@
assert isinstance(foo_txt, NullPyPathLocal)
#
f = foo_txt.open('w')
- assert f.name == NULLPATHNAME
+ assert f.name == os.devnull
More information about the pypy-commit
mailing list