Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Python 3 compatibility #10

Merged
merged 1 commit into from

3 participants

@dominicrodger

This change hopefully makes django-setuptest compatible with both Python 2 and Python 3.

@dominicrodger

Anything I can do to help get this merged? This'd really help out with getting a couple of my projects to fully functional Python 3 support.

@hedleyroos hedleyroos was assigned
@smn
Owner

@hedleyroos, @miltontony or @Rizziepit could you pls review?

@dominicrodger

Incidentally, happy to remove dependency on six, since it's only used for the StringIO shim (I added it thinking I'd need it for other things too), let me know if it'd help for me to prepare a patch with that change. Thanks for taking a look.

@hedleyroos hedleyroos merged commit befaae5 into praekelt:master
@hedleyroos
Owner

Merged. Six is fine. Thanks for the contribution!

@dominicrodger

Awesome - thanks @hedleyroos :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2013
  1. @dominicrodger

    Python 3 compatibility

    dominicrodger authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 9 deletions.
  1. +1 −0  setup.py
  2. +1 −1  setuptest/__init__.py
  3. +8 −8 setuptest/setuptest.py
View
1  setup.py
@@ -23,6 +23,7 @@ def read(filepath):
'coverage',
'django',
'pep8',
+ 'six',
],
classifiers=[
"Programming Language :: Python",
View
2  setuptest/__init__.py
@@ -2,7 +2,7 @@
import sys
from setuptools.command.test import test as TestCommand
-from setuptest import LabelException
+from .setuptest import LabelException
class test(TestCommand):
user_options = TestCommand.user_options + [
View
16 setuptest/setuptest.py
@@ -7,7 +7,7 @@
from coverage import coverage, misc
from distutils import log
-from StringIO import StringIO
+from six import StringIO
class LabelException(Exception):
@@ -88,7 +88,7 @@ def build_tests(self):
if self.options['label']:
try:
tests.append(build_test(package))
- except (ImproperlyConfigured, ValueError), e:
+ except (ImproperlyConfigured, ValueError) as e:
self.handle_label_exception(e)
else:
app = get_app(package)
@@ -101,7 +101,7 @@ def build_tests(self):
if self.options['label']:
try:
tests.append(build_test(package))
- except (ImproperlyConfigured, ValueError), e:
+ except (ImproperlyConfigured, ValueError) as e:
self.handle_label_exception(e)
else:
app = get_app(package)
@@ -109,14 +109,14 @@ def build_tests(self):
break
except LabelException:
raise
- except Exception, e:
+ except Exception as e:
if exception != str(e):
traceback.print_exc()
exception = str(e)
time.sleep(1)
- except ImproperlyConfigured, e:
+ except ImproperlyConfigured as e:
log.info("Warning: %s" % e)
- except ImportError, e:
+ except ImportError as e:
log.info("Warning: %s" % e)
return tests
@@ -129,7 +129,7 @@ def configure(self):
from django.utils.importlib import import_module
try:
test_settings = import_module('test_settings')
- except ImportError, e:
+ except ImportError as e:
log.info('ImportError: Unable to import test settings: %s' % e)
sys.exit(1)
@@ -154,7 +154,7 @@ def coverage_report(self):
omit = ['*tests*']
self.cov.report(include=include, omit=omit)
self.cov.xml_report(include=include, omit=omit)
- except misc.CoverageException, e:
+ except misc.CoverageException as e:
log.info("Coverage Exception: %s" % e)
def resolve_packages(self):
Something went wrong with that request. Please try again.