holger krekel avatar holger krekel committed 143c77a

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

Comments (0)

Files changed (6)

_pytest/__init__.py

 #
+__version__ = '2.0.3.dev3'

_pytest/config.py

         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)
     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__):

_pytest/junitxml.py

                 '<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
 

_pytest/python.py

     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)
         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)
 (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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.