[pypy-commit] pypy default: On Windows, we're actually using the tempfile module to implement

arigo noreply at buildbot.pypy.org
Thu Feb 27 08:52:23 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r69500:21e9670e179b
Date: 2014-02-27 08:51 +0100
http://bitbucket.org/pypy/pypy/changeset/21e9670e179b/

Log:	On Windows, we're actually using the tempfile module to implement
	os.tmpfile(). This test checks that os.tmpfile() tries to put its
	temporary file in the root directory --- and you don't have
	*permissions* to put it here typically. So, the test expects a
	failure, which it doesn't get. Duh.

diff --git a/lib-python/2.7/test/test_os.py b/lib-python/2.7/test/test_os.py
--- a/lib-python/2.7/test/test_os.py
+++ b/lib-python/2.7/test/test_os.py
@@ -129,9 +129,13 @@
                         fp = os.tmpfile()
                     except OSError, second:
                         self.assertEqual(first.args, second.args)
+                        return
                     else:
-                        self.fail("expected os.tmpfile() to raise OSError")
-                    return
+                        if test_support.check_impl_detail(pypy=False):
+                            self.fail("expected os.tmpfile() to raise OSError")
+                        # on PyPy, os.tmpfile() uses the tempfile module
+                        # anyway, so works even if we cannot write in root.
+                        fp.close()
                 else:
                     # open() worked, therefore, tmpfile() should work.  Close our
                     # dummy file and proceed with the test as normal.


More information about the pypy-commit mailing list