Control: tags -1 + patch

The attached patch fixes the test suite for Python 3.5. The behaviour of
junitxml is correct.

Helmut
diff -Nru pyjunitxml-0.6/debian/changelog pyjunitxml-0.6/debian/changelog
--- pyjunitxml-0.6/debian/changelog     2013-08-28 20:29:34.000000000 +0200
+++ pyjunitxml-0.6/debian/changelog     2017-07-26 11:19:31.000000000 +0200
@@ -1,3 +1,10 @@
+pyjunitxml (0.6-1.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS (test suite failure with Python 3.5, Closes: #802124).
+
+ -- Helmut Grohne <h.gro...@intenta.de>  Wed, 26 Jul 2017 11:18:56 +0200
+
 pyjunitxml (0.6-1.1) unstable; urgency=low
 
   * NMU with the maintainer's consent.
diff -Nru pyjunitxml-0.6/debian/patches/ftbfs-802124.patch 
pyjunitxml-0.6/debian/patches/ftbfs-802124.patch
--- pyjunitxml-0.6/debian/patches/ftbfs-802124.patch    1970-01-01 
01:00:00.000000000 +0100
+++ pyjunitxml-0.6/debian/patches/ftbfs-802124.patch    2017-07-26 
11:18:53.000000000 +0200
@@ -0,0 +1,96 @@
+From: Helmut Grohne <h.gro...@intenta.de>
+Subject: fix test suite failure with Python 3.5
+Debian-Bug: https://bugs.debian.org/802124
+Last-Update: 2017-07-26
+
+The referenced test case classes reside inside test methods of an outer test
+case class. In older versions of Python they were simply qualified with the
+module. Since Python 3.5, their full name includes the outer class, the outer
+method name and the part "<locals>". Thus we are seeing class names such as
+"junitxml.tests.test_junitxml.TestJUnitXmlResult.test_erroring_test.<locals>.Errors"
+where pyjunitxml expected just "junitxml.tests.test_junitxml.Errors".
+
+We opt for stripping the class qualification in the central get_output method.
+
+--- pyjunitxml-0.6.orig/junitxml/tests/test_junitxml.py
++++ pyjunitxml-0.6/junitxml/tests/test_junitxml.py
+@@ -38,10 +38,11 @@ class TestJUnitXmlResult(unittest.TestCa
+     def get_output(self):
+         output = self.output.getvalue()
+         # Collapse detailed regions into specific strings we can match on
+-        return re.sub(r'(?s)<failure (.*?)>.*?</failure>',
++        return re.sub(r'(<testcase classname=")[^"]*\.([^"]*?")',
++                      r'\1\2', re.sub(r'(?s)<failure (.*?)>.*?</failure>',
+             r'<failure \1>failure</failure>', re.sub(
+             r'(?s)<error (.*?)>.*?</error>', r'<error \1>error</error>',
+-            re.sub(r'time="\d+\.\d+"', 'time="0.000"', output)))
++            re.sub(r'time="\d+\.\d+"', 'time="0.000"', output))))
+ 
+     def run_test_or_simulate(self, test, method_name, manual_method,
+         *manual_args):
+@@ -112,7 +113,7 @@ class TestJUnitXmlResult(unittest.TestCa
+         Errors("test_me").run(self.result)
+         self.result.stopTestRun()
+         self.assertEqual("""<testsuite errors="1" failures="0" name="" 
tests="1" time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Errors" name="test_me" 
time="0.000">
++<testcase classname="Errors" name="test_me" time="0.000">
+ <error type="ZeroDivisionError">error</error>
+ </testcase>
+ </testsuite>
+@@ -126,7 +127,7 @@ class TestJUnitXmlResult(unittest.TestCa
+         Fails("test_me").run(self.result)
+         self.result.stopTestRun()
+         self.assertEqual("""<testsuite errors="0" failures="1" name="" 
tests="1" time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Fails" name="test_me" 
time="0.000">
++<testcase classname="Fails" name="test_me" time="0.000">
+ <failure type="AssertionError">failure</failure>
+ </testcase>
+ </testsuite>
+@@ -140,7 +141,7 @@ class TestJUnitXmlResult(unittest.TestCa
+         Passes("test_me").run(self.result)
+         self.result.stopTestRun()
+         self.assertEqual("""<testsuite errors="0" failures="0" name="" 
tests="1" time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Passes" name="test_me" 
time="0.000"/>
++<testcase classname="Passes" name="test_me" time="0.000"/>
+ </testsuite>
+ """, self.get_output())
+ 
+@@ -154,7 +155,7 @@ class TestJUnitXmlResult(unittest.TestCa
+         self.result.stopTestRun()
+         output = self.get_output()
+         expected = """<testsuite errors="0" failures="0" name="" tests="1" 
time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Skips" name="test_me" 
time="0.000">
++<testcase classname="Skips" name="test_me" time="0.000">
+ <skip>yo</skip>
+ </testcase>
+ </testsuite>
+@@ -174,13 +175,13 @@ class TestJUnitXmlResult(unittest.TestCa
+         self.result.stopTestRun()
+         output = self.get_output()
+         expected = """<testsuite errors="0" failures="1" name="" tests="1" 
time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Succeeds" name="test_me" 
time="0.000">
++<testcase classname="Succeeds" name="test_me" time="0.000">
+ <failure type="unittest.case._UnexpectedSuccess"/>
+ </testcase>
+ </testsuite>
+ """
+         expected_old = """<testsuite errors="0" failures="0" name="" 
tests="1" time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.Succeeds" name="test_me" 
time="0.000"/>
++<testcase classname="Succeeds" name="test_me" time="0.000"/>
+ </testsuite>
+ """
+         if output != expected_old:
+@@ -201,11 +202,11 @@ class TestJUnitXmlResult(unittest.TestCa
+         self.result.stopTestRun()
+         output = self.get_output()
+         expected = """<testsuite errors="0" failures="0" name="" tests="1" 
time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.ExpectedFail" 
name="test_me" time="0.000"/>
++<testcase classname="ExpectedFail" name="test_me" time="0.000"/>
+ </testsuite>
+ """
+         expected_old = """<testsuite errors="0" failures="1" name="" 
tests="1" time="0.000">
+-<testcase classname="junitxml.tests.test_junitxml.ExpectedFail" 
name="test_me" time="0.000">
++<testcase classname="ExpectedFail" name="test_me" time="0.000">
+ <failure type="AssertionError">failure</failure>
+ </testcase>
+ </testsuite>
diff -Nru pyjunitxml-0.6/debian/patches/series 
pyjunitxml-0.6/debian/patches/series
--- pyjunitxml-0.6/debian/patches/series        1970-01-01 01:00:00.000000000 
+0100
+++ pyjunitxml-0.6/debian/patches/series        2017-07-26 11:14:06.000000000 
+0200
@@ -0,0 +1 @@
+ftbfs-802124.patch

Reply via email to