Skip to content

Commit

Permalink
Python 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicrodger committed Mar 30, 2013
1 parent f4eacb4 commit 5354273
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def read(filepath):
'coverage',
'django',
'pep8',
'six',
],
classifiers=[
"Programming Language :: Python",
Expand Down
2 changes: 1 addition & 1 deletion setuptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + [
Expand Down
16 changes: 8 additions & 8 deletions setuptest/setuptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from coverage import coverage, misc
from distutils import log
from StringIO import StringIO
from six import StringIO


class LabelException(Exception):
Expand Down Expand Up @@ -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)
Expand All @@ -101,22 +101,22 @@ 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)
tests.append(build_suite(app))
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
Expand All @@ -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)

Expand All @@ -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):
Expand Down

0 comments on commit 5354273

Please sign in to comment.