Commits

Ronny Pfannschmidt committed f71595a

a fix

Comments (0)

Files changed (3)

+# HG changeset patch
+# Parent 145316e6e0d6898308eb7f7421472aab0b4a1bd5
+diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py
+--- a/_pytest/junitxml.py
++++ b/_pytest/junitxml.py
+@@ -199,15 +199,16 @@ class LogXML(object):
+         numtests = self.passed + self.failed
+ 
+         logfile.write('<?xml version="1.0" encoding="utf-8"?>')
+-        logfile.write(Junit.testsuite(
+-            self.tests,
++        suite = Junit.testsuite(
+             name="",
+             errors=self.errors,
+             failures=self.failed,
+             skips=self.skipped,
+             tests=numtests,
+             time="%.3f" % suite_time_delta,
+-        ).unicode(indent=0))
++        )
++        suite.extend(self.tests)
++        logfile.write(suite.unicode(indent=0))
+         logfile.close()
+ 
+     def pytest_terminal_summary(self, terminalreporter):

parametrize-indirect

+# HG changeset patch
+# Parent 6ef58a23837631d521e24ba7100a8cc40cb67c5e
+test & fix - metafunc.parametrize shouldnt check if indirect params are funcarg names
+
+diff --git a/CHANGELOG b/CHANGELOG
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -9,6 +9,7 @@ Changes between 2.2.1 and 2.2.2.dev
+   test directory was renamed and some pyc/__pycache__ remain
+ - fix issue106: allow parametrize to be applied multiple times
+   e.g. from module, class and at function level.
++- don't check of indirect parameters are funcarg names
+ - add chdir method to monkeypatch funcarg
+ - fix crash resulting from calling monkeypatch undo a second time
+ - extend reports accepting kwargs to set arbitrary additional attributes
+diff --git a/_pytest/python.py b/_pytest/python.py
+--- a/_pytest/python.py
++++ b/_pytest/python.py
+@@ -629,9 +629,11 @@ class Metafunc:
+         if not isinstance(argnames, (tuple, list)):
+             argnames = (argnames,)
+             argvalues = [(val,) for val in argvalues]
+-        for arg in argnames:
+-            if arg not in self.funcargnames:
+-                raise ValueError("%r has no argument %r" %(self.function, arg))
++        if not indirect:
++            #XXX should we also check for the opposite case?
++            for arg in argnames:
++                if arg not in self.funcargnames:
++                    raise ValueError("%r has no argument %r" %(self.function, arg))
+         valtype = indirect and "params" or "funcargs"
+         if not ids:
+             idmaker = IDMaker()
+diff --git a/testing/test_python.py b/testing/test_python.py
+--- a/testing/test_python.py
++++ b/testing/test_python.py
+@@ -983,11 +983,12 @@ class TestMetafunc:
+         metafunc = funcargs.Metafunc(func)
+         metafunc.parametrize('x', [1], indirect=True)
+         metafunc.parametrize('y', [2,3], indirect=True)
++        metafunc.parametrize('unnamed', [1], indirect=True)
+         assert len(metafunc._calls) == 2
+         assert metafunc._calls[0].funcargs == {}
+         assert metafunc._calls[1].funcargs == {}
+-        assert metafunc._calls[0].params == dict(x=1,y=2)
+-        assert metafunc._calls[1].params == dict(x=1,y=3)
++        assert metafunc._calls[0].params == dict(x=1,y=2, unnamed=1)
++        assert metafunc._calls[1].params == dict(x=1,y=3, unnamed=1)
+ 
+     def test_addcalls_and_parametrize_indirect(self):
+         def func(x, y): pass
+parametrize-indirect
 parametrize-items
+junit
 regendoc-pytesthighlight #+doc
 fnmatch-python-test-names