Author: Manuel Jacob <[email protected]>
Branch: py3k
Changeset: r77867:e6c53e141773
Date: 2015-06-04 18:26 +0200
http://bitbucket.org/pypy/pypy/changeset/e6c53e141773/

Log:    Add workaround for when host interpreter has slightly different
        errnos than interpreter under test.

        See comment for details.

diff --git a/pypy/module/errno/test/test_errno.py 
b/pypy/module/errno/test/test_errno.py
--- a/pypy/module/errno/test/test_errno.py
+++ b/pypy/module/errno/test/test_errno.py
@@ -11,8 +11,28 @@
         assert not hasattr(self.errno, '__file__')
 
     def test_constants(self):
-        for code, name in self.errorcode.items():
+        host_errorcode = self.errorcode.copy()
+        # On some systems, ENOTSUP is an alias to EOPNOTSUPP.  Adjust the
+        # host_errorcode dictionary in case the host interpreter has slightly
+        # different errorcodes than the interpreter under test
+        if ('ENOTSUP' not in host_errorcode.values() and
+            'ENOTSUP' in self.errno.errorcode.values()):
+            host_errorcode[self.errno.ENOTSUP] = 'ENOTSUP'
+        if ('EOPNOTSUPP' not in host_errorcode.values() and
+            'EOPNOTSUPP' in self.errno.errorcode.values()):
+            host_errorcode[self.errno.EOPNOTSUPP] = 'EOPNOTSUPP'
+        for code, name in host_errorcode.items():
             assert getattr(self.errno, name) == code
 
     def test_errorcode(self):
-        assert self.errorcode == self.errno.errorcode
+        host_errorcode = self.errorcode.copy()
+        # On some systems, ENOTSUP is an alias to EOPNOTSUPP.  Adjust the
+        # host_errorcode dictionary in case the host interpreter has slightly
+        # different errorcodes than the interpreter under test
+        if ('ENOTSUP' not in host_errorcode.values() and
+            'ENOTSUP' in self.errno.errorcode.values()):
+            host_errorcode[self.errno.ENOTSUP] = 'ENOTSUP'
+        if ('EOPNOTSUPP' not in host_errorcode.values() and
+            'EOPNOTSUPP' in self.errno.errorcode.values()):
+            host_errorcode[self.errno.EOPNOTSUPP] = 'EOPNOTSUPP'
+        assert host_errorcode == self.errno.errorcode
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to