[pypy-svn] pypy simplify-conftest: There were two functions named pytest_runtest_setup...
amauryfa
commits-noreply at bitbucket.org
Mon Jan 10 16:30:25 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: simplify-conftest
Changeset: r40558:fe7b3ee91842
Date: 2011-01-10 15:01 +0100
http://bitbucket.org/pypy/pypy/changeset/fe7b3ee91842/
Log: There were two functions named pytest_runtest_setup... merge them,
and use the "spaceconfig" in a simple module.
diff --git a/pypy/module/__builtin__/test/test_buffer.py b/pypy/module/__builtin__/test/test_buffer.py
--- a/pypy/module/__builtin__/test/test_buffer.py
+++ b/pypy/module/__builtin__/test/test_buffer.py
@@ -4,8 +4,7 @@
from pypy.conftest import gettestobjspace
class AppTestBuffer:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=('array',))
+ spaceconfig = {'objspace.usemodules.array': True}
def test_unicode_buffer(self):
import sys
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -100,14 +100,6 @@
space.eq_w = appsupport.eq_w.__get__(space)
return space
-def pytest_runtest_setup(item):
- if isinstance(item, PyPyTestFunction):
- appclass = item.getparent(PyPyClassCollector)
- if appclass is not None:
- spaceconfig = getattr(appclass.obj, 'spaceconfig', None)
- if spaceconfig:
- appclass.obj.space = gettestobjspace(**spaceconfig)
-
class TinyObjSpace(object):
def __init__(self, **kwds):
import sys
@@ -352,7 +344,15 @@
return super(PyPyTestFunction, self).repr_failure(excinfo)
def pytest_runtest_setup(__multicall__, item):
+ if isinstance(item, PyPyTestFunction):
+ appclass = item.getparent(PyPyClassCollector)
+ if appclass is not None:
+ spaceconfig = getattr(appclass.obj, 'spaceconfig', None)
+ if spaceconfig:
+ appclass.obj.space = gettestobjspace(**spaceconfig)
+
__multicall__.execute()
+
if not getattr(item.obj, 'dont_track_allocations', False):
leakfinder.start_tracking_allocations()
More information about the Pypy-commit
mailing list