[pypy-commit] cffi default: Oops, tests fail if we run them one by one

arigo pypy.commits at gmail.com
Wed Mar 2 15:22:43 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2646:d7ec0dceb9ed
Date: 2016-03-02 21:22 +0100
http://bitbucket.org/cffi/cffi/changeset/d7ec0dceb9ed/

Log:	Oops, tests fail if we run them one by one

diff --git a/testing/embedding/test_basic.py b/testing/embedding/test_basic.py
--- a/testing/embedding/test_basic.py
+++ b/testing/embedding/test_basic.py
@@ -32,8 +32,12 @@
         pythonpath.insert(0, cffi_base)
     return os.pathsep.join(pythonpath)
 
-def setup_module(mod):
-    mod.org_env = os.environ.copy()
+def copy_away_env():
+    global org_env
+    try:
+        org_env
+    except NameError:
+        org_env = os.environ.copy()
 
 
 class EmbeddingTests:
@@ -121,6 +125,7 @@
             os.chdir(curdir)
 
     def patch_environment(self):
+        copy_away_env()
         path = self.get_path()
         # for libpypy-c.dll or Python27.dll
         path = os.path.split(sys.executable)[0] + os.path.pathsep + path


More information about the pypy-commit mailing list