Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r70221:556f9ed20ccc
Date: 2014-03-23 17:23 -0700
http://bitbucket.org/pypy/pypy/changeset/556f9ed20ccc/

Log:    Merged in msabramo/pypy/test_SetFromErrnoWithFilename__tweaks (pull
        request #210)

        Tweaks to test_SetFromErrnoWithFilename

diff --git a/pypy/module/cpyext/test/test_pyerrors.py 
b/pypy/module/cpyext/test/test_pyerrors.py
--- a/pypy/module/cpyext/test/test_pyerrors.py
+++ b/pypy/module/cpyext/test/test_pyerrors.py
@@ -199,26 +199,21 @@
             assert e.filename == None
 
     def test_SetFromErrnoWithFilename(self):
-        import sys
-        if sys.platform != 'win32':
-            skip("callbacks through ll2ctypes modify errno")
         import errno, os
 
         module = self.import_extension('foo', [
                 ("set_from_errno", "METH_NOARGS",
                  '''
                  errno = EBADF;
-                 PyErr_SetFromErrnoWithFilename(PyExc_OSError, "blyf");
+                 PyErr_SetFromErrnoWithFilename(PyExc_OSError, 
"/path/to/file");
                  return NULL;
                  '''),
                 ],
                 prologue="#include <errno.h>")
-        try:
-            module.set_from_errno()
-        except OSError, e:
-            assert e.filename == "blyf"
-            assert e.errno == errno.EBADF
-            assert e.strerror == os.strerror(errno.EBADF)
+        exc_info = raises(OSError, module.set_from_errno)
+        assert exc_info.value.filename == "/path/to/file"
+        assert exc_info.value.errno == errno.EBADF
+        assert exc_info.value.strerror == os.strerror(errno.EBADF)
 
     def test_PyErr_Display(self):
         module = self.import_extension('foo', [
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to