diff --git a/django_jenkins/runner.py b/django_jenkins/runner.py index 9bd5939b..bd16a15f 100644 --- a/django_jenkins/runner.py +++ b/django_jenkins/runner.py @@ -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): @@ -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) @@ -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): """ diff --git a/setup.py b/setup.py index 410a1acf..9bfb12e1 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='django-jenkins', - version='1.11.0', + version='1.12.0', author='Mikhail Podgurskiy', author_email='kmmbvnr@gmail.com', description='Plug and play continuous integration with django and jenkins', @@ -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' ],