Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[report]
include =
setup.py
tests/*
xmlrunner/*
48 changes: 29 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
name: [
"py310",
"py311",
"py312",
"py313",
"py314",
]
include:
- python-version: 3.7
toxenv: py37
- python-version: 3.8
toxenv: py38
- python-version: 3.8
toxenv: py38-djangolts
- python-version: 3.8
toxenv: py38-djangocurr
- python-version: 3.8
toxenv: py38-quality
- python-version: 3.9
toxenv: py39
- python-version: "3.10"
toxenv: py310
- name: py310
python-version: "3.10"
tox_env: py310
- name: py311
python-version: "3.11"
tox_env: py311
- name: py312
python-version: "3.12"
tox_env: py312
- name: py313
python-version: "3.13"
tox_env: py313
- name: py314
python-version: "3.14"
tox_env: py314
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -40,19 +48,21 @@ jobs:
lsb_release -a
- name: Install
env:
TOXENV: ${{ matrix.toxenv }}
TOXENV: ${{ matrix.tox_env }}
run: |
pip install tox-gh-actions codecov coveralls
pip --version
tox --version
- name: Script
run: |
tox -v
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
tox run -v
- name: After Failure
if: ${{ failure() }}
run: |
more .tox/log/* | cat
more .tox/*/log/* | cat
- name: Upload to Codecov
run: |
tox -e uploadcodecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ dist/*
.tox
.coverage
htmlcov/

# autogenerated
xmlrunner/version.py
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ checkversion:
git show-ref --tags | grep -q $$(git log -1 --pretty=%H) || (echo "DID NOT TAG VERSION"; exit 1)

dist: checkversion build/publish/bin
build/publish/bin/python setup.py sdist
build/publish/bin/python setup.py bdist_wheel
build/publish/bin/python -m build

publish: dist/ build/publish/bin
build/publish/bin/twine upload dist/*
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ If you use Git and want to get the latest *development* version:
````bash
$ git clone https://github.com/xmlrunner/unittest-xml-reporting.git
$ cd unittest-xml-reporting
$ sudo python setup.py install
$ sudo python -m pip install .
````

Or get the latest *development* version as a tarball:
Expand All @@ -115,7 +115,7 @@ Or get the latest *development* version as a tarball:
$ wget https://github.com/xmlrunner/unittest-xml-reporting/archive/master.zip
$ unzip master.zip
$ cd unittest-xml-reporting
$ sudo python setup.py install
$ sudo python -m pip install .
````

Or you can manually download the latest released version from
Expand Down
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=77",
"setuptools-scm[toml]>=6.2.3",
]


[project]
name = "unittest-xml-reporting"
license = "BSD-2-Clause"
license-files = [ "LICENSE" ]
dynamic = [
"version",
]
description = "unittest-based test runner with Ant/JUnit like XML reporting."
keywords = [
"pyunit",
"unittest",
"junit xml",
"xunit",
"report",
"testrunner",
"xmlrunner",
]
readme = "README.md"
authors = [
{name = "Daniel Fernandes Martins"},
{name = "Damien Nozay"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
]
requires-python = ">=3.10"
dependencies = [
"lxml",
]

[project.urls]
Homepage = "http://github.com/xmlrunner/unittest-xml-reporting/tree/master/"


[tool.setuptools_scm]
write_to = "xmlrunner/version.py"

[tool.distutils.bdist_wheel]
universal = 1
python-tag = "py3"
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

6 changes: 6 additions & 0 deletions tests/discovery_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest


class DiscoveryTest(unittest.TestCase):
def test_discovery_pass(self):
pass
6 changes: 6 additions & 0 deletions tests/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,16 +796,22 @@ def test_xmlrunner_error_in_call(self):
testsuite_output = self.stream.getvalue()
self.assertIn('Exception: Massive fail', testsuite_output)

@unittest.skipIf(not unittest.BaseTestSuite._cleanup,
'skip - do not cleanup')
@unittest.skipIf(not hasattr(sys, 'getrefcount'),
'skip - PyPy does not have sys.getrefcount.')
@unittest.skipIf((3, 0) <= sys.version_info < (3, 4),
'skip - test not garbage collected. '
'https://bugs.python.org/issue11798.')
def test_xmlrunner_hold_traceback(self):
import gc

suite = unittest.TestSuite()
suite.addTest(self.DummyRefCountTest('test_fail'))
countBeforeTest = sys.getrefcount(self.DummyRefCountTest.dummy)
runner = self._test_xmlrunner(suite)

gc.collect()
countAfterTest = sys.getrefcount(self.DummyRefCountTest.dummy)
self.assertEqual(countBeforeTest, countAfterTest)

Expand Down
47 changes: 35 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,55 @@ testpaths = tests
norecursedirs = tests/django_example

[tox]
envlist = begin,py{py3,37,38,39,310},pytest,py38-django{lts,curr},end,quality
envlist = begin,py{py3,310,311,312,313,314},pytest,py314-django{lts,curr},end,quality

[gh-actions]
python =
3.7: py37,pytest
3.8: begin,py38,py38-django{lts,curr},end,quality
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
3.14: begin,py314,py314-django{tls,curr},end,quality

[testenv]
deps =
coverage
codecov>=1.4.0
coveralls
djangolts,pytest: django~=3.2.0
djangocurr: django~=4.0.0
pytest: pytest
djangolts: django~=4.2.0
djangocurr: django~=5.2.0
pytest
lxml>=3.6.0
commands =
coverage run --append setup.py test
coverage report --omit='.tox/*'
python -m xmlrunner discover -p test_xmlrunner_output
python -m coverage run --append -m pytest
python -m coverage report --omit='.tox/*'
python -m xmlrunner discover -p "discovery_test.py"
passenv =
CI
TRAVIS
TRAVIS_*
CODECOV_TOKEN
COVERALLS_REPO_TOKEN
COVERALLS_*
GITHUB_ACTION
GITHUB_HEAD_REF
GITHUB_REF
GITHUB_REPOSITORY
GITHUB_RUN_ID
GITHUB_SHA
GITHUB_TOKEN

[testenv:uploadcodecov]
commands =
codecov -e TOXENV
-coveralls
passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT CODECOV_TOKEN COVERALLS_REPO_TOKEN GITHUB_ACTION GITHUB_HEAD_REF GITHUB_REF GITHUB_REPOSITORY GITHUB_RUN_ID GITHUB_SHA

[testenv:uploadcoveralls]
commands =
-coveralls --service=github

[testenv:finishcoveralls]
commands =
-coveralls --service=github --finish

[testenv:pytest]
commands = pytest
Expand Down
5 changes: 4 additions & 1 deletion xmlrunner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"""

# Allow version to be detected at runtime.
from .version import __version__
try:
from .version import __version__
except ImportError:
__version__ = "unknown"

from .runner import XMLTestRunner

Expand Down
18 changes: 16 additions & 2 deletions xmlrunner/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ def __init__(self, first, second):
self._second = second

def flush(self):
self._first.flush()
self._second.flush()
try:
self._first.flush()
except ValueError:
pass
try:
self._second.flush()
except ValueError:
pass

def writable(self):
return True
Expand Down Expand Up @@ -188,6 +194,9 @@ def get_error_info(self):
"""
return self.test_exception_info

def shortDescription(self):
return self.test_description


class _XMLTestResult(TextTestResult):
"""
Expand Down Expand Up @@ -673,3 +682,8 @@ def generate_reports(self, test_runner):
def _exc_info_to_string(self, err, test):
"""Converts a sys.exc_info()-style tuple of values into a string."""
return super(_XMLTestResult, self)._exc_info_to_string(err, test)

def getDescription(self, test):
if isinstance(test, tuple):
test = test[0]
return super().getDescription(test)
2 changes: 0 additions & 2 deletions xmlrunner/version.py

This file was deleted.