GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit fed654ed authored by holger krekel's avatar holger krekel

update to pytest-2.0.3.dev3, containing few fixes/speedups

parent 446be8fd
#
__version__ = '2.0.3.dev3'
......@@ -252,6 +252,16 @@ class Config(object):
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)
......
......@@ -164,14 +164,17 @@ class PluginManager(object):
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__):
......
......@@ -106,7 +106,13 @@ class LogXML(object):
'<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
......
......@@ -70,11 +70,13 @@ def pytest_pycollect_makeitem(__multicall__, collector, name, obj):
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 @@ class PyCollectorMixin(PyobjMixin, pytest.Collector):
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)
......
......@@ -3,11 +3,11 @@ unit and functional testing with Python.
(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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment