[pypy-commit] pypy py3k: Replace marshal with _md5 in test, so that it works on CPython (no idea why this is needed, but whatevs)

rlamy pypy.commits at gmail.com
Tue Sep 27 14:59:44 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87420:885295b9e9ea
Date: 2016-09-27 19:59 +0100
http://bitbucket.org/pypy/pypy/changeset/885295b9e9ea/

Log:	Replace marshal with _md5 in test, so that it works on CPython (no
	idea why this is needed, but whatevs)

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
@@ -265,28 +265,28 @@
         # taken from https://bugs.pypy.org/issue1514, with extra cases
         # that show a difference with CPython: we can get on CPython
         # several module objects for the same built-in module :-(
-        import sys, marshal
+        import sys, _md5
 
-        old = marshal.loads
-        marshal.loads = 42
+        old = _md5.md5
+        _md5.md5 = 42
 
         # save, re-import, restore.
-        saved = sys.modules.pop('marshal')
-        marshal2 = __import__('marshal')
-        assert marshal2 is not marshal
-        assert marshal2.loads is old
-        assert marshal2 is sys.modules['marshal']
-        assert marshal is saved
-        assert marshal.loads == 42
+        saved = sys.modules.pop('_md5')
+        _md52 = __import__('_md5')
+        assert _md52 is not _md5
+        assert _md52.md5 is old
+        assert _md52 is sys.modules['_md5']
+        assert _md5 is saved
+        assert _md5.md5 == 42
 
-        import marshal
-        assert marshal.loads is old
+        import _md5
+        assert _md5.md5 is old
 
-        sys.modules['marshal'] = saved
-        import marshal
-        assert marshal.loads == 42
+        sys.modules['_md5'] = saved
+        import _md5
+        assert _md5.md5 == 42
 
-        marshal.loads = old
+        _md5.md5 = old
 
     def test_get_tag(self):
         import imp


More information about the pypy-commit mailing list