Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure compatibility with Django 4 and Python 3.9 #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 8 additions & 5 deletions django_jenkins/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from xml.etree import ElementTree as ET

from django.test.runner import DiscoverRunner
from django.utils.encoding import smart_text
try:
from django.utils.encoding import smart_str
except:
from django.utils.encoding import smart_text as smart_str


class EXMLTestResult(TextTestResult):
Expand Down Expand Up @@ -64,12 +67,12 @@ def stopTest(self, test):
output = sys.stdout.getvalue() if hasattr(sys.stdout, 'getvalue') else ''
if output:
sysout = ET.SubElement(self.testcase, 'system-out')
sysout.text = smart_text(output, errors='ignore')
sysout.text = smart_str(output, errors='ignore')

error = sys.stderr.getvalue() if hasattr(sys.stderr, 'getvalue') else ''
if error:
syserr = ET.SubElement(self.testcase, 'system-err')
syserr.text = smart_text(error, errors='ignore')
syserr.text = smart_str(error, errors='ignore')

super(EXMLTestResult, self).stopTest(test)

Expand Down Expand Up @@ -103,8 +106,8 @@ def _add_tb_to_test(self, test, test_result, err):
exc_class, exc_value, tb = err
tb_str = self._exc_info_to_string(err, test)
test_result.set('type', '%s.%s' % (exc_class.__module__, exc_class.__name__))
test_result.set('message', smart_text(exc_value))
test_result.text = smart_text(tb_str)
test_result.set('message', smart_str(exc_value))
test_result.text = smart_str(tb_str)

def dump_xml(self, output_dir):
"""
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='django-jenkins',
version='1.11.0',
version='1.12.0',
author='Mikhail Podgurskiy',
author_email='[email protected]',
description='Plug and play continuous integration with django and jenkins',
Expand All @@ -36,6 +36,10 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Testing'
],
Expand Down