[pypy-commit] pypy py3k: 'Fix' test_merge_compiler_flags() to pass on CPython (and fail on pypy3)

rlamy pypy.commits at gmail.com
Wed Oct 5 15:30:35 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87603:3ab16226e73d
Date: 2016-10-05 20:29 +0100
http://bitbucket.org/pypy/pypy/changeset/3ab16226e73d/

Log:	'Fix' test_merge_compiler_flags() to pass on CPython (and fail on
	pypy3)

diff --git a/pypy/module/cpyext/test/test_eval.py b/pypy/module/cpyext/test/test_eval.py
--- a/pypy/module/cpyext/test/test_eval.py
+++ b/pypy/module/cpyext/test/test_eval.py
@@ -308,6 +308,7 @@
         assert mod.f(42) == 47
 
     def test_merge_compiler_flags(self):
+        import sys
         module = self.import_extension('foo', [
             ("get_flags", "METH_NOARGS",
              """
@@ -321,7 +322,14 @@
         assert module.get_flags() == (0, 0)
 
         ns = {'module':module}
+        if not hasattr(sys, 'pypy_version_info'):  # no barry_as_FLUFL on pypy
+            exec("""from __future__ import barry_as_FLUFL    \nif 1:
+                    def nested_flags():
+                        return module.get_flags()""", ns)
+            assert ns['nested_flags']() == (1, 0x40000)
+
+        # the division future should have no effect on Python 3
         exec("""from __future__ import division    \nif 1:
                 def nested_flags():
                     return module.get_flags()""", ns)
-        assert ns['nested_flags']() == (1, 0x2000)  # CO_FUTURE_DIVISION
+        assert ns['nested_flags']() == (0, 0)


More information about the pypy-commit mailing list