Hello community, here is the log from the commit of package python-unittest-xml-reporting for openSUSE:Factory checked in at 2020-03-18 12:39:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-unittest-xml-reporting (Old) and /work/SRC/openSUSE:Factory/.python-unittest-xml-reporting.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-unittest-xml-reporting" Wed Mar 18 12:39:10 2020 rev:19 rq:785932 version:3.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-unittest-xml-reporting/python-unittest-xml-reporting.changes 2020-02-11 22:24:27.643536521 +0100 +++ /work/SRC/openSUSE:Factory/.python-unittest-xml-reporting.new.3160/python-unittest-xml-reporting.changes 2020-03-18 12:43:42.168890556 +0100 @@ -1,0 +2,6 @@ +Tue Mar 10 12:56:35 UTC 2020 - pgaj...@suse.com + +- version update to 3.0.2 + * no upstream changelog found + +------------------------------------------------------------------- Old: ---- 2.5.2.tar.gz New: ---- 3.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-unittest-xml-reporting.spec ++++++ --- /var/tmp/diff_new_pack.92dXis/_old 2020-03-18 12:43:43.448891366 +0100 +++ /var/tmp/diff_new_pack.92dXis/_new 2020-03-18 12:43:43.448891366 +0100 @@ -17,8 +17,9 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 Name: python-unittest-xml-reporting -Version: 2.5.2 +Version: 3.0.2 Release: 0 Summary: PyUnit-based test runner with JUnit like XML reporting License: LGPL-3.0-or-later @@ -33,9 +34,6 @@ Requires: python-six >= 1.4.0 Provides: python-xmlrunner = %{version} BuildArch: noarch -%ifpython2 -BuildRequires: python2-mock -%endif %python_subpackages %description ++++++ 2.5.2.tar.gz -> 3.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/.travis.yml new/unittest-xml-reporting-3.0.2/.travis.yml --- old/unittest-xml-reporting-2.5.2/.travis.yml 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/.travis.yml 2020-02-20 03:44:01.000000000 +0100 @@ -4,14 +4,9 @@ matrix: include: - - python: 2.7 - env: TOXENV=py27 - - python: 2.7 - env: TOXENV=py27-djangolts - - python: 2.7 - env: TOXENV=py27-djangocurr - - python: 2.7 - env: TOXENV=quality + - os: linux + python: pypy3.5-6.0 + env: TOXENV=pypy3 - python: 3.5 env: TOXENV=py35 - python: 3.6 @@ -20,20 +15,14 @@ env: TOXENV=py37 - python: 3.8 env: TOXENV=py38 + - python: 3.8 + env: TOXENV=py38-djangolts + - python: 3.8 + env: TOXENV=py38-djangocurr + - python: 3.8 + env: TOXENV=quality - python: 3.8-dev env: TOXENV=pytest - - os: linux - dist: xenial - python: pypy2.7-6.0 - env: TOXENV=pypy - services: - - docker - - os: linux - dist: xenial - python: pypy3.5-6.0 - env: TOXENV=pypy3 - services: - - docker before_install: - python --version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/README.md new/unittest-xml-reporting-3.0.2/README.md --- old/unittest-xml-reporting-2.5.2/README.md 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/README.md 2020-02-20 03:44:01.000000000 +0100 @@ -14,33 +14,82 @@ The files can be consumed by a wide range of tools, such as build systems, IDEs and continuous integration servers. -## Schema -There are many schemas with minor differences. -We use one that is compatible with Jenkins xUnit plugin, a copy is -available under `tests/vendor/jenkins/xunit-plugin/junit-10.xsd` (see attached license). +## Requirements + +* Python 3.5+ +* Please note Python 2.7 end-of-life was in Jan 2020, last version supporting 2.7 was 2.5.2 +* Please note Python 3.4 end-of-life was in Mar 2019, last version supporting 3.4 was 2.5.2 +* Please note Python 2.6 end-of-life was in Oct 2013, last version supporting 2.6 was 1.14.0 + + +## Limited support for `unittest.TestCase.subTest` + +https://docs.python.org/3/library/unittest.html#unittest.TestCase.subTest + +`unittest` has the concept of sub-tests for a `unittest.TestCase`; this doesn't map well to an existing xUnit concept, so you won't find it in the schema. What that means, is that you lose some granularity +in the reports for sub-tests. + +`unittest` also does not report successful sub-tests, so the accounting won't be exact. + +## Jenkins plugins + +- Jenkins JUnit plugin : https://plugins.jenkins.io/junit/ +- Jenkins xUnit plugin : https://plugins.jenkins.io/xunit/ + +### Jenkins JUnit plugin + +This plugin does not perform XSD validation (at time of writing) and should parse the XML file without issues. + +### Jenkins xUnit plugin version 1.100 + +- [Jenkins (junit-10.xsd), xunit plugin (2014-2018)](https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd), version `1.100`. + +This plugin does perfom XSD validation and uses the more lax XSD. This should parse the XML file without issues. + +### Jenkins xUnit plugin version 1.104+ -- [Jenkins (junit-10.xsd), xunit plugin (2014-2018)](https://github.com/jenkinsci/xunit-plugin/blob/14c6e39c38408b9ed6280361484a13c6f5becca7/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd), please note the latest versions (2.2.4 and above are not backwards compatible) +- [Jenkins (junit-10.xsd), xunit plugin (2018-current)](https://github.com/jenkinsci/xunit-plugin/blob/ae25da5089d4f94ac6c4669bf736e4d416cc4665/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd), version `1.104`+. + +This plugin does perfom XSD validation and uses the more strict XSD. + +See https://github.com/xmlrunner/unittest-xml-reporting/issues/209 + +``` +import io +import unittest +import xmlrunner + +# run the tests storing results in memory +out = io.BytesIO() +unittest.main( + testRunner=xmlrunner.XMLTestRunner(output=out), + failfast=False, buffer=False, catchbreak=False, exit=False) +``` + +Transform the results removing extra attributes. +``` +from xmlrunner.extra.xunit_plugin import transform + +with open('TEST-report.xml', 'wb') as report: + report.write(transform(out.getvalue())) + +``` + +## JUnit Schema ? + +There are many tools claiming to write JUnit reports, so you will find many schemas with minor differences. + +We used the XSD that was available in the Jenkins xUnit plugin version `1.100`; a copy is available under `tests/vendor/jenkins/xunit-plugin/.../junit-10.xsd` (see attached license). You may also find these resources useful: - https://stackoverflow.com/questions/4922867/what-is-the-junit-xml-format-specification-that-hudson-supports - https://stackoverflow.com/questions/11241781/python-unittests-in-jenkins -- [Jenkins (junit-10.xsd), xunit plugin 2.2.4+](https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd) - [JUnit-Schema (JUnit.xsd)](https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd) - [Windyroad (JUnit.xsd)](http://windyroad.com.au/dl/Open%20Source/JUnit.xsd) - [a gist (Jenkins xUnit test result schema)](https://gist.github.com/erikd/4192748) -## Things that are somewhat broken - -Python 3 has the concept of sub-tests for a `unittest.TestCase`; this doesn't map well to an existing -xUnit concept, so you won't find it in the schema. What that means, is that you lose some granularity -in the reports for sub-tests. - -## Requirements - -* Python 2.7 or 3.3+ -* Please note Python 2.6 end-of-life was in Oct 2013, last version supporting 2.6 was 1.14.0 ## Installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/setup.cfg new/unittest-xml-reporting-3.0.2/setup.cfg --- old/unittest-xml-reporting-2.5.2/setup.cfg 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/setup.cfg 2020-02-20 03:44:01.000000000 +0100 @@ -1,3 +1,3 @@ [bdist_wheel] universal = 1 -python-tag = py2.py3 +python-tag = py3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/setup.py new/unittest-xml-reporting-3.0.2/setup.py --- old/unittest-xml-reporting-2.5.2/setup.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/setup.py 2020-02-20 03:44:01.000000000 +0100 @@ -15,13 +15,10 @@ with codecs.open(readme_path, 'rb', 'utf8') as readme_file: long_description = readme_file.read() -install_requires = ['six>=1.4.0'] - # this is for sdist to work. import sys -if sys.version_info < (2, 7): - # python 2.6 no longer supported, use last 1.x release instead. - raise RuntimeError('This version requires Python 2.7+') # pragma: no cover +if sys.version_info < (3, 5): + raise RuntimeError('This version requires Python 3.5+') # pragma: no cover setup( name = 'unittest-xml-reporting', @@ -32,6 +29,7 @@ long_description_content_type = 'text/markdown', license = 'BSD', platforms = ['Any'], + python_requires='>=3.5', keywords = [ 'pyunit', 'unittest', 'junit xml', 'xunit', 'report', 'testrunner', 'xmlrunner' ], @@ -43,8 +41,6 @@ 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -57,6 +53,5 @@ packages = ['xmlrunner', 'xmlrunner.extra'], zip_safe = False, include_package_data = True, - install_requires = install_requires, test_suite = 'tests' ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/builder_test.py new/unittest-xml-reporting-3.0.2/tests/builder_test.py --- old/unittest-xml-reporting-2.5.2/tests/builder_test.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/builder_test.py 2020-02-20 03:44:01.000000000 +0100 @@ -6,7 +6,6 @@ from xml.dom.minidom import Document from xmlrunner import builder -import six class TestXMLContextTest(unittest.TestCase): @@ -27,9 +26,9 @@ self.assertEqual(name, 'context-name') def test_current_context_invalid_unicode_name(self): - self.root.begin('tag', six.u('context-name\x01\x0B')) + self.root.begin('tag', u'context-name\x01\x0B') name = self.root.element.getAttribute('name') - self.assertEqual(name, six.u('context-name\uFFFD\uFFFD')) + self.assertEqual(name, u'context-name\uFFFD\uFFFD') def test_increment_valid_testsuites_counters(self): self.root.begin('testsuites', 'name') @@ -99,10 +98,10 @@ self.doc = self.builder._xml_doc self.builder.begin_context('testsuites', 'name') - self.valid_chars = six.u('выбор') + self.valid_chars = u'выбор' self.invalid_chars = '\x01' - self.invalid_chars_replace = six.u('\ufffd') + self.invalid_chars_replace = u'\ufffd' def test_root_has_no_parent(self): self.assertIsNone(self.builder.current_context().parent) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/django_example/app/tests.py new/unittest-xml-reporting-3.0.2/tests/django_example/app/tests.py --- old/unittest-xml-reporting-2.5.2/tests/django_example/app/tests.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/django_example/app/tests.py 2020-02-20 03:44:01.000000000 +0100 @@ -4,4 +4,13 @@ # Create your tests here. class DummyTestCase(TestCase): def test_pass(self): + """Test Pass""" + pass + + def test_negative_comment1(self): + """Use a close comment XML tag -->""" + pass + + def test_negative_comment2(self): + """Check XML tag </testsuites>""" pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/django_test.py new/unittest-xml-reporting-3.0.2/tests/django_test.py --- old/unittest-xml-reporting-2.5.2/tests/django_test.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/django_test.py 2020-02-20 03:44:01.000000000 +0100 @@ -4,10 +4,7 @@ import os from os import path import glob -try: - from unittest import mock -except ImportError: - import mock +from unittest import mock import tempfile import shutil @@ -19,6 +16,7 @@ from django.test.utils import get_runner from django.conf import settings, UserSettingsHolder from django.apps import apps + settings.configure(DEBUG=True) TESTS_DIR = path.dirname(__file__) @@ -37,6 +35,7 @@ self.old_settings = settings._wrapped os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings' settings.INSTALLED_APPS # load settings on first access + settings.DATABASES['default'] = {} settings.DATABASES['default']['NAME'] = path.join( self.tmpdir, 'db.sqlilte3') # this goes around the "settings already loaded" issue. @@ -58,12 +57,16 @@ test_ids = [test.id() for test in suite] self.assertEqual(test_ids, [ 'app2.tests.DummyTestCase.test_pass', + 'app.tests.DummyTestCase.test_negative_comment1', + 'app.tests.DummyTestCase.test_negative_comment2', 'app.tests.DummyTestCase.test_pass', ]) suite = runner.build_suite(test_labels=[]) test_ids = [test.id() for test in suite] self.assertEqual(set(test_ids), set([ 'app.tests.DummyTestCase.test_pass', + 'app.tests.DummyTestCase.test_negative_comment1', + 'app.tests.DummyTestCase.test_negative_comment2', 'app2.tests.DummyTestCase.test_pass', ])) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/testsuite.py new/unittest-xml-reporting-3.0.2/tests/testsuite.py --- old/unittest-xml-reporting-2.5.2/tests/testsuite.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/testsuite.py 2020-02-20 03:44:01.000000000 +0100 @@ -15,7 +15,7 @@ from xmlrunner.result import _XMLTestResult import doctest import tests.doctest_example -from six import StringIO, BytesIO, exec_ +from io import StringIO, BytesIO from tempfile import mkdtemp from tempfile import mkstemp from shutil import rmtree @@ -24,17 +24,13 @@ from lxml import etree import os import os.path +from unittest import mock -try: - from unittest import mock -except ImportError: - import mock - -def _load_schema(): - path = os.path.join(os.path.dirname(__file__), - 'vendor/jenkins/xunit-plugin', - 'junit-10.xsd') +def _load_schema(version): + path = os.path.join( + os.path.dirname(__file__), + 'vendor/jenkins/xunit-plugin', version, 'junit-10.xsd') with open(path, 'r') as schema_file: schema_doc = etree.parse(schema_file) schema = etree.XMLSchema(schema_doc) @@ -42,12 +38,10 @@ raise RuntimeError('Could not load JUnit schema') # pragma: no cover -JUnitSchema = _load_schema() - - -def validate_junit_report(text): +def validate_junit_report(version, text): document = etree.parse(BytesIO(text)) - JUnitSchema.assertValid(document) + schema = _load_schema(version) + schema.assertValid(document) class TestCaseSubclassWithNoSuper(unittest.TestCase): @@ -114,7 +108,7 @@ return func(*args, **kwargs) """ evaldict = dict(func=f) - exec_(code, evaldict) + exec(code, evaldict) return evaldict['wrapper'] @@ -402,21 +396,13 @@ # allow output non-ascii letters to stdout orig_stdout = sys.stdout - if getattr(sys.stdout, 'buffer', None): - # Python3 - sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') - else: - # Python2 - import codecs - sys.stdout = codecs.getwriter("utf-8")(sys.stdout) + sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') try: runner.run(suite) finally: - if getattr(sys.stdout, 'buffer', None): - # Python3 - # Not to be closed when TextIOWrapper is disposed. - sys.stdout.detach() + # Not to be closed when TextIOWrapper is disposed. + sys.stdout.detach() sys.stdout = orig_stdout outdir.seek(0) output = outdir.read() @@ -662,7 +648,7 @@ self.assertTrue(i_properties < i_testcase < i_system_out < i_system_err) # XSD validation - for good measure. - validate_junit_report(output) + validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output) def test_junitxml_xsd_validation_empty_properties(self): suite = unittest.TestSuite() @@ -677,7 +663,33 @@ outdir.seek(0) output = outdir.read() self.assertNotIn('<properties>'.encode('utf8'), output) - validate_junit_report(output) + validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output) + + @unittest.skipIf(hasattr(sys, 'pypy_version_info'), + 'skip - PyPy + lxml seems to be hanging') + def test_xunit_plugin_transform(self): + suite = unittest.TestSuite() + suite.addTest(self.DummyTest('test_fail')) + suite.addTest(self.DummyTest('test_pass')) + suite.properties = None + outdir = BytesIO() + runner = xmlrunner.XMLTestRunner( + stream=self.stream, output=outdir, verbosity=self.verbosity, + **self.runner_kwargs) + runner.run(suite) + outdir.seek(0) + output = outdir.read() + + validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output) + with self.assertRaises(etree.DocumentInvalid): + validate_junit_report('ae25da5089d4f94ac6c4669bf736e4d416cc4665', output) + + from xmlrunner.extra.xunit_plugin import transform + transformed = transform(output) + validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', transformed) + validate_junit_report('ae25da5089d4f94ac6c4669bf736e4d416cc4665', transformed) + self.assertIn('test_pass'.encode('utf8'), transformed) + self.assertIn('test_fail'.encode('utf8'), transformed) def test_xmlrunner_elapsed_times(self): self.runner_kwargs['elapsed_times'] = False @@ -835,10 +847,7 @@ self.assertNotIn('should be printed', r[1].getvalue()) def test_partialmethod(self): - try: - from functools import partialmethod - except ImportError: - raise unittest.SkipTest('functools.partialmethod is not available.') + from functools import partialmethod def test_partialmethod(test): pass class TestWithPartialmethod(unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/14c6e39c38408b9ed6280361484a13c6f5becca7/junit-10.xsd new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/14c6e39c38408b9ed6280361484a13c6f5becca7/junit-10.xsd --- old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/14c6e39c38408b9ed6280361484a13c6f5becca7/junit-10.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/14c6e39c38408b9ed6280361484a13c6f5becca7/junit-10.xsd 2020-02-20 03:44:01.000000000 +0100 @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +The MIT License (MIT) + +Copyright (c) 2014, Gregory Boissinot + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="failure"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="error"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="skipped"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="properties"> + <xs:complexType> + <xs:sequence> + <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="property"> + <xs:complexType> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="value" type="xs:string" use="required"/> + </xs:complexType> + </xs:element> + + <xs:element name="system-err" type="xs:string"/> + <xs:element name="system-out" type="xs:string"/> + + <xs:element name="testcase"> + <xs:complexType> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="skipped"/> + <xs:element ref="error"/> + <xs:element ref="failure"/> + <xs:element ref="system-out"/> + <xs:element ref="system-err"/> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="assertions" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="timestamp" type="xs:string" use="optional"/> + <xs:attribute name="classname" type="xs:string" use="optional"/> + <xs:attribute name="status" type="xs:string" use="optional"/> + <xs:attribute name="class" type="xs:string" use="optional"/> + <xs:attribute name="file" type="xs:string" use="optional"/> + <xs:attribute name="line" type="xs:string" use="optional"/> + <xs:attribute name="log" type="xs:string" use="optional"/> + <xs:attribute name="group" type="xs:string" use="optional"/> + <xs:attribute name="url" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuite"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="testsuite"/> + <xs:element ref="properties"/> + <xs:element ref="testcase"/> + <xs:element ref="system-out"/> + <xs:element ref="system-err"/> + </xs:choice> + <xs:attribute name="name" type="xs:string" use="optional"/> + <xs:attribute name="tests" type="xs:string" use="required"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="skipped" type="xs:string" use="optional"/> + <xs:attribute name="skips" type="xs:string" use="optional"/> + <xs:attribute name="timestamp" type="xs:string" use="optional"/> + <xs:attribute name="hostname" type="xs:string" use="optional"/> + <xs:attribute name="id" type="xs:string" use="optional"/> + <xs:attribute name="package" type="xs:string" use="optional"/> + <xs:attribute name="assertions" type="xs:string" use="optional"/> + <xs:attribute name="file" type="xs:string" use="optional"/> + <xs:attribute name="skip" type="xs:string" use="optional"/> + <xs:attribute name="log" type="xs:string" use="optional"/> + <xs:attribute name="url" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuites"> + <xs:complexType> + <xs:sequence> + <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="tests" type="xs:string" use="optional"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + +</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/ae25da5089d4f94ac6c4669bf736e4d416cc4665/junit-10.xsd new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/ae25da5089d4f94ac6c4669bf736e4d416cc4665/junit-10.xsd --- old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/ae25da5089d4f94ac6c4669bf736e4d416cc4665/junit-10.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/ae25da5089d4f94ac6c4669bf736e4d416cc4665/junit-10.xsd 2020-02-20 03:44:01.000000000 +0100 @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +The MIT License (MIT) + +Copyright (c) 2014, Gregory Boissinot + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:simpleType name="SUREFIRE_TIME"> + <xs:restriction base="xs:string"> + <xs:pattern value="(([0-9]{0,3},)*[0-9]{3}|[0-9]{0,3})*(\.[0-9]{0,3})?"/> + </xs:restriction> + </xs:simpleType> + + <xs:complexType name="rerunType" mixed="true"> <!-- mixed (XML contains text) to be compatible with version previous than 2.22.1 --> + <xs:sequence> + <xs:element name="stackTrace" type="xs:string" minOccurs="0" /> <!-- optional to be compatible with version previous than 2.22.1 --> + <xs:element name="system-out" type="xs:string" minOccurs="0" /> + <xs:element name="system-err" type="xs:string" minOccurs="0" /> + </xs:sequence> + <xs:attribute name="message" type="xs:string" /> + <xs:attribute name="type" type="xs:string" use="required" /> + </xs:complexType> + + <xs:element name="failure"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string"/> + <xs:attribute name="message" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="error"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string"/> + <xs:attribute name="message" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="skipped"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string"/> + <xs:attribute name="message" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="properties"> + <xs:complexType> + <xs:sequence> + <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="property"> + <xs:complexType> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="value" type="xs:string" use="required"/> + </xs:complexType> + </xs:element> + + <xs:element name="system-err" type="xs:string"/> + <xs:element name="system-out" type="xs:string"/> + <xs:element name="rerunFailure" type="rerunType"/> + <xs:element name="rerunError" type="rerunType"/> + <xs:element name="flakyFailure" type="rerunType"/> + <xs:element name="flakyError" type="rerunType"/> + + <xs:element name="testcase"> + <xs:complexType> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="skipped"/> + <xs:element ref="error"/> + <xs:element ref="failure"/> + <xs:element ref="rerunFailure" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="rerunError" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="flakyFailure" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="flakyError" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-out"/> + <xs:element ref="system-err"/> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="time" type="xs:string"/> + <xs:attribute name="classname" type="xs:string"/> + <xs:attribute name="group" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuite"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="testsuite"/> + <xs:element ref="properties"/> + <xs:element ref="testcase"/> + <xs:element ref="system-out"/> + <xs:element ref="system-err"/> + </xs:choice> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="tests" type="xs:string" use="required"/> + <xs:attribute name="failures" type="xs:string" use="required"/> + <xs:attribute name="errors" type="xs:string" use="required"/> + <xs:attribute name="group" type="xs:string" /> + <xs:attribute name="time" type="SUREFIRE_TIME"/> + <xs:attribute name="skipped" type="xs:string" /> + <xs:attribute name="timestamp" type="xs:string" /> + <xs:attribute name="hostname" type="xs:string" /> + <xs:attribute name="id" type="xs:string" /> + <xs:attribute name="package" type="xs:string" /> + <xs:attribute name="file" type="xs:string"/> + <xs:attribute name="log" type="xs:string"/> + <xs:attribute name="url" type="xs:string"/> + <xs:attribute name="version" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuites"> + <xs:complexType> + <xs:sequence> + <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded" /> + </xs:sequence> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="time" type="SUREFIRE_TIME"/> + <xs:attribute name="tests" type="xs:string" /> + <xs:attribute name="failures" type="xs:string" /> + <xs:attribute name="errors" type="xs:string" /> + </xs:complexType> + </xs:element> + +</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/junit-10.xsd new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/junit-10.xsd --- old/unittest-xml-reporting-2.5.2/tests/vendor/jenkins/xunit-plugin/junit-10.xsd 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tests/vendor/jenkins/xunit-plugin/junit-10.xsd 1970-01-01 01:00:00.000000000 +0100 @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- -The MIT License (MIT) - -Copyright (c) 2014, Gregory Boissinot - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - <xs:element name="failure"> - <xs:complexType mixed="true"> - <xs:attribute name="type" type="xs:string" use="optional"/> - <xs:attribute name="message" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="error"> - <xs:complexType mixed="true"> - <xs:attribute name="type" type="xs:string" use="optional"/> - <xs:attribute name="message" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="skipped"> - <xs:complexType mixed="true"> - <xs:attribute name="type" type="xs:string" use="optional"/> - <xs:attribute name="message" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="properties"> - <xs:complexType> - <xs:sequence> - <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="property"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="value" type="xs:string" use="required"/> - </xs:complexType> - </xs:element> - - <xs:element name="system-err" type="xs:string"/> - <xs:element name="system-out" type="xs:string"/> - - <xs:element name="testcase"> - <xs:complexType> - <xs:sequence> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="skipped"/> - <xs:element ref="error"/> - <xs:element ref="failure"/> - <xs:element ref="system-out"/> - <xs:element ref="system-err"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="assertions" type="xs:string" use="optional"/> - <xs:attribute name="time" type="xs:string" use="optional"/> - <xs:attribute name="timestamp" type="xs:string" use="optional"/> - <xs:attribute name="classname" type="xs:string" use="optional"/> - <xs:attribute name="status" type="xs:string" use="optional"/> - <xs:attribute name="class" type="xs:string" use="optional"/> - <xs:attribute name="file" type="xs:string" use="optional"/> - <xs:attribute name="line" type="xs:string" use="optional"/> - <xs:attribute name="log" type="xs:string" use="optional"/> - <xs:attribute name="group" type="xs:string" use="optional"/> - <xs:attribute name="url" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="testsuite"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="testsuite"/> - <xs:element ref="properties"/> - <xs:element ref="testcase"/> - <xs:element ref="system-out"/> - <xs:element ref="system-err"/> - </xs:choice> - <xs:attribute name="name" type="xs:string" use="optional"/> - <xs:attribute name="tests" type="xs:string" use="required"/> - <xs:attribute name="failures" type="xs:string" use="optional"/> - <xs:attribute name="errors" type="xs:string" use="optional"/> - <xs:attribute name="time" type="xs:string" use="optional"/> - <xs:attribute name="disabled" type="xs:string" use="optional"/> - <xs:attribute name="skipped" type="xs:string" use="optional"/> - <xs:attribute name="skips" type="xs:string" use="optional"/> - <xs:attribute name="timestamp" type="xs:string" use="optional"/> - <xs:attribute name="hostname" type="xs:string" use="optional"/> - <xs:attribute name="id" type="xs:string" use="optional"/> - <xs:attribute name="package" type="xs:string" use="optional"/> - <xs:attribute name="assertions" type="xs:string" use="optional"/> - <xs:attribute name="file" type="xs:string" use="optional"/> - <xs:attribute name="skip" type="xs:string" use="optional"/> - <xs:attribute name="log" type="xs:string" use="optional"/> - <xs:attribute name="url" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - - <xs:element name="testsuites"> - <xs:complexType> - <xs:sequence> - <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="optional"/> - <xs:attribute name="time" type="xs:string" use="optional"/> - <xs:attribute name="tests" type="xs:string" use="optional"/> - <xs:attribute name="failures" type="xs:string" use="optional"/> - <xs:attribute name="disabled" type="xs:string" use="optional"/> - <xs:attribute name="errors" type="xs:string" use="optional"/> - </xs:complexType> - </xs:element> - -</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/tox.ini new/unittest-xml-reporting-3.0.2/tox.ini --- old/unittest-xml-reporting-2.5.2/tox.ini 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/tox.ini 2020-02-20 03:44:01.000000000 +0100 @@ -4,25 +4,23 @@ norecursedirs = tests/django_example [tox] -envlist = begin,py{27,py,py3,35,36,37},pytest,py27-django{lts,curr},end,quality +envlist = begin,py{py3,35,36,37,38},pytest,py38-django{lts,curr},end,quality [tox:travis] -2.7 = begin,py27,py27-django{lts,curr},end,quality 3.5 = py35 3.6 = py36 3.7 = py37,pytest -3.8 = py38 +3.8 = begin,py38,py38-django{lts,curr},end,quality [testenv] deps = coverage codecov>=1.4.0 coveralls - djangolts,pytest: django>=1.8.8,<1.9.0 - djangocurr: django>=1.9.1 + djangolts,pytest: django>=1.11.0,<1.12.0 + djangocurr: django>=2.2.0 pytest: pytest lxml>=3.6.0 - mock commands = coverage run --append setup.py test coverage report --omit='.tox/*' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/builder.py new/unittest-xml-reporting-3.0.2/xmlrunner/builder.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/builder.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/builder.py 2020-02-20 03:44:01.000000000 +0100 @@ -2,7 +2,6 @@ import sys import datetime import time -import six from xml.dom.minidom import Document @@ -20,18 +19,18 @@ _char_tail = '' if sys.maxunicode > 0x10000: - _char_tail = six.u('%s-%s') % ( - six.unichr(0x10000), - six.unichr(min(sys.maxunicode, 0x10FFFF)) + _char_tail = (u'%s-%s') % ( + chr(0x10000), + chr(min(sys.maxunicode, 0x10FFFF)) ) _nontext_sub = re.compile( - six.u(r'[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD%s]') % _char_tail, + r'[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD%s]' % _char_tail, re.U ).sub -def replace_nontext(text, replacement=six.u('\uFFFD')): +def replace_nontext(text, replacement=u'\uFFFD'): return _nontext_sub(replacement, text) @@ -104,7 +103,7 @@ ) if valid_counter_for_element: - value = six.text_type( + value = str( self.counters.get(counter_name, 0) ) self.element.setAttribute(counter_name, value) @@ -192,7 +191,7 @@ element = self._xml_doc.createElement(tag) for key, value in kwargs.items(): - filtered_value = replace_nontext(six.text_type(value)) + filtered_value = replace_nontext(str(value)) element.setAttribute(key, filtered_value) if content: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/extra/xunit_plugin.py new/unittest-xml-reporting-3.0.2/xmlrunner/extra/xunit_plugin.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/extra/xunit_plugin.py 1970-01-01 01:00:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/extra/xunit_plugin.py 2020-02-20 03:44:01.000000000 +0100 @@ -0,0 +1,29 @@ +import io +import lxml.etree as etree + + +TRANSFORM = etree.XSLT(etree.XML(b'''\ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> + <xsl:output method="xml" indent="yes" /> + + <!-- /dev/null for these attributes --> + <xsl:template match="//testcase/@file" /> + <xsl:template match="//testcase/@line" /> + <xsl:template match="//testcase/@timestamp" /> + + <!-- copy the rest --> + <xsl:template match="node()|@*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*" /> + </xsl:copy> + </xsl:template> +</xsl:stylesheet>''')) + + +def transform(xml_data): + out = io.BytesIO() + xml_doc = etree.XML(xml_data) + result = TRANSFORM(xml_doc) + result.write(out) + return out.getvalue() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/result.py new/unittest-xml-reporting-3.0.2/xmlrunner/result.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/result.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/result.py 2020-02-20 03:44:01.000000000 +0100 @@ -6,10 +6,9 @@ import datetime import time import traceback -import six import re from os import path -from six.moves import StringIO +from io import StringIO # use direct import to bypass freezegun from time import time @@ -39,7 +38,7 @@ ]) _illegal_ranges = [ - "%s-%s" % (six.unichr(low), six.unichr(high)) + "%s-%s" % (chr(low), chr(high)) for (low, high) in _illegal_unichrs ] @@ -50,27 +49,13 @@ STDERR_LINE = '\nStderr:\n%s' -def _to_unicode(data): - """Returns unicode in Python2 and str in Python3""" - if six.PY3: - return six.text_type(data) - try: - # Try utf8 - return six.text_type(data) - except UnicodeDecodeError: - return repr(data).decode('utf8', 'replace') - - def safe_unicode(data, encoding='utf8'): """Return a unicode string containing only valid XML characters. encoding - if data is a byte string it is first decoded to unicode using this encoding. """ - data = _to_unicode(data) - if isinstance(data, six.binary_type): - # e.g. IronPython, see #182 - data = data.decode(encoding) + data = str(data) return INVALID_XML_1_0_UNICODE_RE.sub('', data) @@ -104,6 +89,9 @@ def writable(self): return True + def getvalue(self): + return self._second.getvalue() + def writelines(self, lines): self._first.writelines(lines) self._second.writelines(lines) @@ -118,8 +106,7 @@ return wrote else: - # file-like object in Python2 - # It doesn't return wrote bytes. + # file-like object that doesn't return wrote bytes. self._first.write(b) self._second.write(b) return len(b) @@ -141,7 +128,7 @@ SKIP: 'skipped', } - def __init__(self, test_result, test_method, outcome=SUCCESS, err=None, subTest=None, filename=None, lineno=None): + def __init__(self, test_result, test_method, outcome=SUCCESS, err=None, subTest=None, filename=None, lineno=None, doc=None): self.test_result = test_result self.outcome = outcome self.elapsed_time = 0 @@ -172,6 +159,7 @@ self.filename = filename self.lineno = lineno + self.doc = doc def id(self): return self.test_id @@ -213,6 +201,7 @@ self.properties = properties # junit testsuite properties self.filename = None self.lineno = None + self.doc = None if infoclass is None: self.infoclass = _TestInfo else: @@ -226,6 +215,7 @@ """ test_info.filename = self.filename test_info.lineno = self.lineno + test_info.doc = self.doc target_list.append(test_info) def callback(): @@ -271,6 +261,8 @@ # Handle partial and partialmethod objects. test_method = getattr(test_method, 'func', test_method) _, self.lineno = inspect.getsourcelines(test_method) + + self.doc = test_method.__doc__ except (AttributeError, IOError, TypeError): # issue #188, #189, #195 # some frameworks can make test method opaque. @@ -568,6 +560,12 @@ if test_result.lineno is not None: testcase.setAttribute('line', str(test_result.lineno)) + if test_result.doc is not None: + comment = str(test_result.doc) + # The use of '--' is forbidden in XML comments + comment = comment.replace('--', '--') + testcase.appendChild(xml_document.createComment(comment)) + result_elem_name = test_result.OUTCOME_ELEMENTS[test_result.outcome] if result_elem_name is not None: @@ -609,7 +607,7 @@ all_results = self._get_info_by_testcase() outputHandledAsString = \ - isinstance(test_runner.output, six.string_types) + isinstance(test_runner.output, str) if (outputHandledAsString and not os.path.exists(test_runner.output)): os.makedirs(test_runner.output) @@ -659,49 +657,4 @@ def _exc_info_to_string(self, err, test): """Converts a sys.exc_info()-style tuple of values into a string.""" - if six.PY3: - # It works fine in python 3 - try: - return super(_XMLTestResult, self)._exc_info_to_string( - err, test) - except AttributeError: - # We keep going using the legacy python <= 2 way - pass - - # This comes directly from python2 unittest - exctype, value, tb = err - # Skip test runner traceback levels - while tb and self._is_relevant_tb_level(tb): - tb = tb.tb_next - - if exctype is test.failureException: - # Skip assert*() traceback levels - length = self._count_relevant_tb_levels(tb) - msgLines = traceback.format_exception(exctype, value, tb, length) - else: - msgLines = traceback.format_exception(exctype, value, tb) - - if self.buffer: - output = self._stdout_capture.getvalue() - error = self._stdout_capture.getvalue() - if output: - if not output.endswith('\n'): - output += '\n' - msgLines.append(STDOUT_LINE % output) - if error: - if not error.endswith('\n'): - error += '\n' - msgLines.append(STDERR_LINE % error) - # This is the extra magic to make sure all lines are str - encoding = getattr(sys.stdout, 'encoding', 'utf-8') - if encoding is None: - encoding = 'utf-8' - - lines = [] - for line in msgLines: - if not isinstance(line, str): - # utf8 shouldnt be hard-coded, but not sure f - line = line.encode(encoding) - lines.append(line) - - return ''.join(lines) + return super(_XMLTestResult, self)._exc_info_to_string(err, test) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/runner.py new/unittest-xml-reporting-3.0.2/xmlrunner/runner.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/runner.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/runner.py 2020-02-20 03:44:01.000000000 +0100 @@ -3,8 +3,6 @@ import sys import time -import six - from .unittest import TextTestRunner, TestProgram from .result import _XMLTestResult @@ -19,10 +17,8 @@ """ def __init__(self, output='.', outsuffix=None, elapsed_times=True, encoding=UTF8, - resultclass=None, warnings=None, + resultclass=None, **kwargs): - if six.PY3: - kwargs['warnings'] = warnings super(XMLTestRunner, self).__init__(**kwargs) self.output = output self.encoding = encoding diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/unittest.py new/unittest-xml-reporting-3.0.2/xmlrunner/unittest.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/unittest.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/unittest.py 2020-02-20 03:44:01.000000000 +0100 @@ -8,11 +8,7 @@ from unittest import TestResult, _TextTestResult from unittest.result import failfast from unittest.main import TestProgram -try: - from unittest.main import USAGE_AS_MAIN - TestProgram.USAGE = USAGE_AS_MAIN -except ImportError: - pass + __all__ = ( 'unittest', 'TextTestRunner', 'TestResult', '_TextTestResult', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unittest-xml-reporting-2.5.2/xmlrunner/version.py new/unittest-xml-reporting-3.0.2/xmlrunner/version.py --- old/unittest-xml-reporting-2.5.2/xmlrunner/version.py 2019-11-08 06:47:00.000000000 +0100 +++ new/unittest-xml-reporting-3.0.2/xmlrunner/version.py 2020-02-20 03:44:01.000000000 +0100 @@ -1,2 +1,2 @@ -__version__ = '2.5.2' +__version__ = '3.0.2'