[pypy-commit] pypy py3.6: Fix tests that can't work on PyPy (and avoid a warning)

rlamy pypy.commits at gmail.com
Fri Dec 20 19:26:13 EST 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r98351:996be08dae82
Date: 2019-12-21 00:25 +0000
http://bitbucket.org/pypy/pypy/changeset/996be08dae82/

Log:	Fix tests that can't work on PyPy (and avoid a warning)

diff --git a/lib-python/3/test/test_coroutines.py b/lib-python/3/test/test_coroutines.py
--- a/lib-python/3/test/test_coroutines.py
+++ b/lib-python/3/test/test_coroutines.py
@@ -890,11 +890,11 @@
 
     def test_corotype_1(self):
         ct = types.CoroutineType
-        self.assert_('into coroutine' in ct.send.__doc__ or
+        self.assertTrue('into coroutine' in ct.send.__doc__ or
                      'into generator/coroutine' in ct.send.__doc__)
-        self.assert_('inside coroutine' in ct.close.__doc__ or
+        self.assertTrue('inside coroutine' in ct.close.__doc__ or
                      'inside generator/coroutine' in ct.close.__doc__)
-        self.assert_('in coroutine' in ct.throw.__doc__ or
+        self.assertTrue('in coroutine' in ct.throw.__doc__ or
                      'in generator/coroutine' in ct.throw.__doc__)
         self.assertIn('of the coroutine', ct.__dict__['__name__'].__doc__)
         self.assertIn('of the coroutine', ct.__dict__['__qualname__'].__doc__)
@@ -1238,8 +1238,8 @@
 
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aenter__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             # it's important that __aexit__ wasn't called
             run_async(foo())
 
@@ -1261,8 +1261,8 @@
         except TypeError as exc:
             self.assertRegex(
                 exc.args[0],
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int")
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression")
             self.assertTrue(exc.__context__ is not None)
             self.assertTrue(isinstance(exc.__context__, ZeroDivisionError))
         else:
@@ -1286,8 +1286,8 @@
                 CNT += 1
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 1)
 
@@ -1300,8 +1300,8 @@
                     break
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 2)
 
@@ -1314,8 +1314,8 @@
                     continue
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 3)
 
@@ -1327,8 +1327,8 @@
                 return
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 4)
 


More information about the pypy-commit mailing list