From 6d3ee1d81ae5672946298528f25a59720607bebb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arttu=20Per=C3=A4l=C3=A4?= <arttu@perala.me>
Date: Tue, 3 Jan 2023 13:52:29 +0200
Subject: [PATCH 1/2] Run automated tests against Python 3.11

---
 .github/workflows/tests.yml | 2 ++
 setup.py                    | 1 +
 tox.ini                     | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 6d220fc..c94dade 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -26,6 +26,8 @@ jobs:
             toxenv: py39
           - python-version: "3.10"
             toxenv: py310
+          - python-version: "3.11"
+            toxenv: py311
     steps:
       - name: Checkout
         uses: actions/checkout@v2
diff --git a/setup.py b/setup.py
index c524ed4..dc2cad7 100755
--- a/setup.py
+++ b/setup.py
@@ -49,6 +49,7 @@
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Software Development :: Libraries :: Python Modules',
diff --git a/tox.ini b/tox.ini
index c290205..4bf4e34 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@ 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,37,38,39,310,311},pytest,py38-django{lts,curr},end,quality
 
 [gh-actions]
 python =
@@ -12,6 +12,7 @@ python =
     3.8: begin,py38,py38-django{lts,curr},end,quality
     3.9: py39
     3.10: py310
+    3.11: py311
 
 [testenv]
 deps =

From f0c57751e8f9faa662a857112ef23585b99b5384 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arttu=20Per=C3=A4l=C3=A4?= <arttu@perala.me>
Date: Tue, 3 Jan 2023 14:36:48 +0200
Subject: [PATCH 2/2] Fix test result description fetching on Python 3.11

Python 3.11 changes `TextTestResult.printErrors()` to print out
unexpected successes and their descriptions.
---
 xmlrunner/result.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xmlrunner/result.py b/xmlrunner/result.py
index 96fc675..03f2150 100644
--- a/xmlrunner/result.py
+++ b/xmlrunner/result.py
@@ -188,6 +188,9 @@ def get_error_info(self):
         """
         return self.test_exception_info
 
+    def shortDescription(self):
+        return self.test_description
+
 
 class _XMLTestResult(TextTestResult):
     """
@@ -673,3 +676,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)