Skip to content

Commit

Permalink
Small hack to ensure that if unittest2 is available (for Python<2.7) …
Browse files Browse the repository at this point in the history
…then replace the existing unittest (old) module. This has the added advantage of cleaning up setup.py somewhat

git-svn-id: https://svn.pyamf.org/branches/test-discovery-780@3364 2dde4cc4-cf3c-0410-b1a3-a9b8ff274da5
  • Loading branch information
njoyce committed Jun 5, 2010
1 parent cc3f59a commit c3f0bdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
10 changes: 8 additions & 2 deletions pyamf/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@

import os.path

import unittest
try:
import unittest2 as unittest
import sys

sys.modules['unittest'] = unittest
except ImportError:
pass


def get_suite():
"""
Return a unittest.TestSuite.
Discover the entire test suite.
"""
loader = unittest.TestLoader()

Expand Down
13 changes: 0 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys, os.path

from setuptools import setup, find_packages, Extension
from setuptools.command import test

try:
from Cython.Distutils import build_ext
Expand All @@ -35,17 +34,6 @@
del sys.modules[k]


class TestCommand(test.test):
def run_tests(self):
import sys

import unittest2

sys.modules['unittest'] = unittest2

return test.test.run_tests(self)


def get_cpyamf_extensions():
"""
Returns a list of all extensions for the cpyamf module. If for some reason
Expand Down Expand Up @@ -150,7 +138,6 @@ def get_test_requirements():
license = "MIT License",
platforms = ["any"],
cmdclass = {
'test': TestCommand,
'build_ext': build_ext,
},
extras_require = {
Expand Down

0 comments on commit c3f0bdb

Please sign in to comment.