[pypy-commit] pypy py3k: Add workaround for when host interpreter has slightly different errnos than interpreter under test.

mjacob noreply at buildbot.pypy.org
Thu Jun 4 18:26:16 CEST 2015


Author: Manuel Jacob <me at manueljacob.de>
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


More information about the pypy-commit mailing list