forked from pool/python-junitxml
- Fix download url
- Make tests pass junitxml-tests.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-junitxml?expand=0&rev=2
This commit is contained in:
committed by
Git OBS Bridge
parent
796d1936f0
commit
bbce720d7b
147
junitxml-tests.patch
Normal file
147
junitxml-tests.patch
Normal file
@@ -0,0 +1,147 @@
|
||||
Index: junitxml-0.7/junitxml/tests/test_junitxml.py
|
||||
===================================================================
|
||||
--- junitxml-0.7.orig/junitxml/tests/test_junitxml.py
|
||||
+++ junitxml-0.7/junitxml/tests/test_junitxml.py
|
||||
@@ -32,6 +32,14 @@ class TestJUnitXmlResult__init__(unittes
|
||||
def test_with_stream(self):
|
||||
result = junitxml.JUnitXmlResult(StringIO())
|
||||
|
||||
+class ConsistantIdTestCase(unittest.TestCase):
|
||||
+ """TestCase who's id is consistant accross python 2 & 3.
|
||||
+
|
||||
+ This is to fix https://bugs.launchpad.net/pyjunitxml/+bug/1491635
|
||||
+ """
|
||||
+
|
||||
+ def id(self):
|
||||
+ return "%s.%s" % (self.__class__.__name__, self._testMethodName)
|
||||
|
||||
class TestJUnitXmlResult(unittest.TestCase):
|
||||
|
||||
@@ -47,16 +55,6 @@ class TestJUnitXmlResult(unittest.TestCa
|
||||
r'(?s)<error (.*?)>.*?</error>', r'<error \1>error</error>',
|
||||
re.sub(r'time="\d+\.\d+"', 'time="0.000"', output)))
|
||||
|
||||
- def run_test_or_simulate(self, test, method_name, manual_method,
|
||||
- *manual_args):
|
||||
- if getattr(test, method_name, None):
|
||||
- test.run(self.result)
|
||||
- else:
|
||||
- # older python - manually execute
|
||||
- self.result.startTest(test)
|
||||
- manual_method(test, *manual_args)
|
||||
- self.result.stopTest(test)
|
||||
-
|
||||
def test_run_duration_handles_datestamping_in_the_past(self):
|
||||
# When used via subunit2junitxml, startTestRun is called before
|
||||
# any tz info in the test stream has been seen.
|
||||
@@ -109,64 +107,47 @@ class TestJUnitXmlResult(unittest.TestCa
|
||||
self.assertTrue('Passes" name="test_me(version_1.6)"' in output)
|
||||
|
||||
def test_erroring_test(self):
|
||||
- class Errors(unittest.TestCase):
|
||||
+ class Errors(ConsistantIdTestCase):
|
||||
def test_me(self):
|
||||
1/0
|
||||
self.result.startTestRun()
|
||||
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>
|
||||
""", self.get_output())
|
||||
|
||||
def test_failing_test(self):
|
||||
- class Fails(unittest.TestCase):
|
||||
+ class Fails(ConsistantIdTestCase):
|
||||
def test_me(self):
|
||||
self.fail()
|
||||
self.result.startTestRun()
|
||||
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>
|
||||
""", self.get_output())
|
||||
|
||||
def test_successful_test(self):
|
||||
- class Passes(unittest.TestCase):
|
||||
+ class Passes(ConsistantIdTestCase):
|
||||
def test_me(self):
|
||||
pass
|
||||
self.result.startTestRun()
|
||||
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())
|
||||
|
||||
- def test_skip_test(self):
|
||||
- class Skips(unittest.TestCase):
|
||||
- def test_me(self):
|
||||
- self.skipTest("yo")
|
||||
- self.result.startTestRun()
|
||||
- test = Skips("test_me")
|
||||
- self.run_test_or_simulate(test, 'skipTest', self.result.addSkip, 'yo')
|
||||
- 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">
|
||||
-<skipped>yo</skipped>
|
||||
-</testcase>
|
||||
-</testsuite>
|
||||
-"""
|
||||
- self.assertEqual(expected, output)
|
||||
-
|
||||
def test_unexpected_success_test(self):
|
||||
- class Succeeds(unittest.TestCase):
|
||||
+ class Succeeds(ConsistantIdTestCase):
|
||||
def test_me(self):
|
||||
pass
|
||||
try:
|
||||
@@ -178,13 +159,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:
|
||||
@@ -192,7 +173,7 @@ class TestJUnitXmlResult(unittest.TestCa
|
||||
|
||||
def test_expected_failure_test(self):
|
||||
expected_failure_support = [True]
|
||||
- class ExpectedFail(unittest.TestCase):
|
||||
+ class ExpectedFail(ConsistantIdTestCase):
|
||||
def test_me(self):
|
||||
self.fail("fail")
|
||||
try:
|
||||
@@ -205,11 +186,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>
|
||||
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 31 11:45:53 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Fix download url
|
||||
- Make tests pass junitxml-tests.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 24 15:01:18 UTC 2018 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-junitxml
|
||||
#
|
||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -12,22 +12,24 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-junitxml
|
||||
Version: 0.7
|
||||
Release: 0
|
||||
Url: https://launchpad.net/pyjunitxml
|
||||
Summary: A pyunit extension to output JUnit compatible XML
|
||||
License: LGPL-3.0+
|
||||
License: LGPL-3.0-or-later
|
||||
Group: Development/Languages/Python
|
||||
Source: http://files.pythonhosted.org/packages/source/j/junitxml/junitxml-%{version}.tar.gz
|
||||
URL: https://launchpad.net/pyjunitxml
|
||||
Source: https://files.pythonhosted.org/packages/source/j/junitxml/junitxml-%{version}.tar.gz
|
||||
Patch0: junitxml-tests.patch
|
||||
BuildRequires: %{python_module nose}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildArch: noarch
|
||||
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
@@ -35,12 +37,14 @@ A Python unittest TestResult that outputs JUnit compatible XML.
|
||||
|
||||
%prep
|
||||
%setup -q -n junitxml-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%python_clone -a %{buildroot}%{_bindir}/pyjunitxml
|
||||
|
||||
@@ -52,7 +56,7 @@ A Python unittest TestResult that outputs JUnit compatible XML.
|
||||
|
||||
%check
|
||||
# tests are failing
|
||||
#nosetests
|
||||
%python_expand nosetests-%{$python_version}
|
||||
|
||||
%files %{python_files}
|
||||
%license COPYING
|
||||
|
||||
Reference in New Issue
Block a user