Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.6
Changeset: r97620:16472df37081
Date: 2019-09-26 15:56 +0100
http://bitbucket.org/pypy/pypy/changeset/16472df37081/

Log:    hg merge default

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -90,10 +90,13 @@
             default=False, dest="applevel_rewrite",
             help="Use assert rewriting in app-level test files (slow)")
 
+@pytest.fixture(scope='class')
+def spaceconfig(request):
+    return getattr(request.cls, 'spaceconfig', {})
+
 @pytest.fixture(scope='function')
-def space(request):
+def space(spaceconfig):
     from pypy.tool.pytest.objspace import gettestobjspace
-    spaceconfig = getattr(request.cls, 'spaceconfig', {})
     return gettestobjspace(**spaceconfig)
 
 
diff --git a/pypy/module/_multiprocessing/test/test_interp_semaphore.py 
b/pypy/module/_multiprocessing/test/test_interp_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_interp_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_interp_semaphore.py
@@ -1,3 +1,4 @@
+import pytest
 import time
 from rpython.rlib.rgil import yield_thread
 from pypy.tool.pytest.objspace import gettestobjspace
@@ -7,8 +8,9 @@
 from pypy.module._multiprocessing.interp_semaphore import (
     create_semaphore, sem_unlink, W_SemLock)
 
-def test_stuff(space):
-    space = gettestobjspace(usemodules=['_multiprocessing', 'thread'])
+@pytest.mark.parametrize('spaceconfig', [
+    {'usemodules': ['_multiprocessing', 'thread']}])
+def test_semlock_release(space):
     sem_name = '/test7'
     _handle = create_semaphore(space, sem_name, 1, 1)
     sem_unlink(sem_name)
diff --git a/pypy/tool/pytest/test/test_appsupport.py 
b/pypy/tool/pytest/test/test_appsupport.py
--- a/pypy/tool/pytest/test/test_appsupport.py
+++ b/pypy/tool/pytest/test/test_appsupport.py
@@ -41,23 +41,38 @@
         "*AppTestMethod*",
     ])
 
-class TestSpaceConfig:
-    @pytest.mark.xfail(reason="Can't check config with -A in pypy3")
-    def test_interp_spaceconfig(self, testdir):
-        setpypyconftest(testdir)
-        p = testdir.makepyfile("""
-            class TestClass:
-                spaceconfig = {"objspace.usemodules._random": False}
-                def setup_class(cls):
-                    assert not cls.space.config.objspace.usemodules._random
-                def test_interp(self, space):
-                    assert self.space is space
-                def test_interp2(self, space):
-                    assert self.space is space
-        """)
-        result = testdir.runpytest(p)
-        assert result.ret == 0
-        result.stdout.fnmatch_lines(["*2 passed*"])
+def test_interp_spaceconfig(testdir):
+    setpypyconftest(testdir)
+    p = testdir.makepyfile("""
+        class TestClass:
+            spaceconfig = {"objspace.usemodules._random": False}
+            def setup_class(cls):
+                assert not cls.space.config.objspace.usemodules._random
+            def test_interp(self, space):
+                assert self.space is space
+            def test_interp2(self, space):
+                assert self.space is space
+    """)
+    result = testdir.runpytest(p)
+    assert result.ret == 0
+    result.stdout.fnmatch_lines(["*2 passed*"])
+
+def test_spaceconfig_param(testdir):
+    setpypyconftest(testdir)
+    p = testdir.makepyfile("""
+        import pytest
+
+        @pytest.mark.parametrize('spaceconfig',
+            [{"objspace.usemodules._random": False}])
+        def test_interp(space):
+            assert not space.config.objspace.usemodules._random
+
+        def test_interp2(space):
+            assert space.config.objspace.usemodules._random
+    """)
+    result = testdir.runpytest(p)
+    assert result.ret == 0
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 def test_applevel_raises_simple_display(testdir):
     setpypyconftest(testdir)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to