[pypy-svn] pypy default: update to pytest-2.0.3.dev3, containing few fixes/speedups
hpk42
commits-noreply at bitbucket.org
Sat Mar 19 20:16:15 CET 2011
Author: holger krekel <holger at merlinux.eu>
Branch:
Changeset: r42803:143c77a3550f
Date: 2011-03-19 20:15 +0100
http://bitbucket.org/pypy/pypy/changeset/143c77a3550f/
Log: update to pytest-2.0.3.dev3, containing few fixes/speedups
diff --git a/_pytest/__init__.py b/_pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,1 +1,2 @@
#
+__version__ = '2.0.3.dev3'
diff --git a/_pytest/python.py b/_pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -70,11 +70,13 @@
res = __multicall__.execute()
if res is not None:
return res
- if collector._istestclasscandidate(name, obj):
+ if inspect.isclass(obj):
#if hasattr(collector.obj, 'unittest'):
# return # we assume it's a mixin class for a TestCase derived one
- Class = collector._getcustomclass("Class")
- return Class(name, parent=collector)
+ if collector.classnamefilter(name):
+ if not hasinit(obj):
+ Class = collector._getcustomclass("Class")
+ return Class(name, parent=collector)
elif collector.funcnamefilter(name) and hasattr(obj, '__call__'):
if is_generator(obj):
return Generator(name, parent=collector)
@@ -194,14 +196,6 @@
return self.ihook.pytest_pycollect_makeitem(
collector=self, name=name, obj=obj)
- def _istestclasscandidate(self, name, obj):
- if self.classnamefilter(name) and \
- inspect.isclass(obj):
- if hasinit(obj):
- # XXX WARN
- return False
- return True
-
def _genfunctions(self, name, funcobj):
module = self.getparent(Module).obj
clscol = self.getparent(Class)
diff --git a/_pytest/core.py b/_pytest/core.py
--- a/_pytest/core.py
+++ b/_pytest/core.py
@@ -164,14 +164,17 @@
def consider_preparse(self, args):
for opt1,opt2 in zip(args, args[1:]):
if opt1 == "-p":
- if opt2.startswith("no:"):
- name = opt2[3:]
- if self.getplugin(name) is not None:
- self.unregister(None, name=name)
- self._name2plugin[name] = -1
- else:
- if self.getplugin(opt2) is None:
- self.import_plugin(opt2)
+ self.consider_pluginarg(opt2)
+
+ def consider_pluginarg(self, arg):
+ if arg.startswith("no:"):
+ name = arg[3:]
+ if self.getplugin(name) is not None:
+ self.unregister(None, name=name)
+ self._name2plugin[name] = -1
+ else:
+ if self.getplugin(arg) is None:
+ self.import_plugin(arg)
def consider_conftest(self, conftestmodule):
if self.register(conftestmodule, name=conftestmodule.__file__):
diff --git a/_pytest/config.py b/_pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -252,6 +252,16 @@
self.hook = self.pluginmanager.hook
self._inicache = {}
+ @classmethod
+ def fromdictargs(cls, option_dict, args):
+ """ constructor useable for subprocesses. """
+ config = cls()
+ config._preparse(args, addopts=False)
+ config.option.__dict__.update(option_dict)
+ for x in config.option.plugins:
+ config.pluginmanager.consider_pluginarg(x)
+ return config
+
def _onimportconftest(self, conftestmodule):
self.trace("loaded conftestmodule %r" %(conftestmodule,))
self.pluginmanager.consider_conftest(conftestmodule)
diff --git a/pytest.py b/pytest.py
--- a/pytest.py
+++ b/pytest.py
@@ -3,11 +3,11 @@
(pypy version of startup script)
see http://pytest.org for details.
"""
-__version__ = '2.0.3.dev1' # base pytest version
__all__ = ['main']
from _pytest.core import main, UsageError, _preloadplugins
from _pytest import core as cmdline
+from _pytest import __version__
# This pytest.py script is located in the pypy source tree
# which has a copy of pytest and py within its source tree.
diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py
--- a/_pytest/junitxml.py
+++ b/_pytest/junitxml.py
@@ -106,7 +106,13 @@
'<skipped message="expected test failure">%s</skipped>',
report.keywords['xfail'])
else:
- self.appendlog("<skipped/>")
+ filename, lineno, skipreason = report.longrepr
+ if skipreason.startswith("Skipped: "):
+ skipreason = skipreason[9:]
+ self.appendlog('<skipped type="pytest.skip" '
+ 'message="%s">%s</skipped>',
+ skipreason, "%s:%s: %s" % report.longrepr,
+ )
self._closetestcase()
self.skipped += 1
More information about the Pypy-commit
mailing list