[pypy-commit] pypy default: Fix imp module test_suffixes so that it runs its intended assertions.

exarkun pypy.commits at gmail.com
Thu Aug 17 08:28:55 EDT 2017


Author: Jean-Paul Calderone <exarkun at twistedmatrix.com>
Branch: 
Changeset: r92162:727bbd9f3a14
Date: 2017-08-17 08:28 -0400
http://bitbucket.org/pypy/pypy/changeset/727bbd9f3a14/

Log:	Fix imp module test_suffixes so that it runs its intended
	assertions.

	Also change one of the assertions to reflect the changed
	implementation for how source files are read (with U instead of r,
	now).

diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py
--- a/pypy/module/imp/test/test_app.py
+++ b/pypy/module/imp/test/test_app.py
@@ -45,15 +45,17 @@
 
     def test_suffixes(self):
         for suffix, mode, type in self.imp.get_suffixes():
-            if mode == self.imp.PY_SOURCE:
+            if type == self.imp.PY_SOURCE:
                 assert suffix == '.py'
-                assert type == 'r'
-            elif mode == self.imp.PY_COMPILED:
+                assert mode == 'U'
+            elif type == self.imp.PY_COMPILED:
                 assert suffix in ('.pyc', '.pyo')
-                assert type == 'rb'
-            elif mode == self.imp.C_EXTENSION:
+                assert mode == 'rb'
+            elif type == self.imp.C_EXTENSION:
                 assert suffix.endswith(('.pyd', '.so'))
-                assert type == 'rb'
+                assert mode == 'rb'
+            else:
+                assert False, ("Unknown type", suffix, mode, type)
 
 
     def test_obscure_functions(self):


More information about the pypy-commit mailing list