jenkins-bot has submitted this change and it was merged.
Change subject: Monkey patch unittest -> unittest2 ......................................................................
Monkey patch unittest -> unittest2
This should fix all mixups between unittest and unittest2 in setup.py runs. In addition, both Python 2.6 /and/ 2.7 will now consistently use unittest2 on Travis.
Change-Id: I5c9b380e01a53b4c96ca8126fca55bfbc482dcdf --- M .travis.yml M setup.py 2 files changed, 22 insertions(+), 14 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml index ac1c930..a1adf16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,8 @@ - python setup.py install - cd ../..
+ - pip install unittest2 + script: - python setup.py test
diff --git a/setup.py b/setup.py index e97d637..b4dc10f 100644 --- a/setup.py +++ b/setup.py @@ -14,12 +14,6 @@ import os import itertools
-from ez_setup import use_setuptools -use_setuptools() - -from setuptools import setup, find_packages -from setuptools.command import install - test_deps = [] testcollector = "tests"
@@ -39,7 +33,12 @@ if sys.version_info < (2, 6, 5): raise RuntimeError("ERROR: Pywikibot only runs under Python 2.6.5 or higher") elif sys.version_info[1] == 6: - test_deps.append('unittest2') + # work around distutils hardcoded unittest dependency + import unittest + if 'test' in sys.argv and sys.version_info < (2, 7): + import unittest2 + sys.modules['unittest'] = unittest2 + script_deps['replicate_wiki.py'] = ['argparse'] testcollector = "tests.utils.collector" dependencies.append('ordereddict') @@ -58,6 +57,20 @@ # when trying to build the C modules. dependencies.append('mwparserfromhell>=0.3.3')
+extra_deps.update(script_deps) +# Add script dependencies as test dependencies, +# so scripts can be compiled in test suite. +if 'PYSETUP_TEST_EXTRAS' in os.environ: + test_deps += list(itertools.chain(*(script_deps.values()))) + + +# late import of setuptools due to monkey-patching above +from ez_setup import use_setuptools +use_setuptools() + +from setuptools import setup, find_packages +from setuptools.command import install +
class pwb_install(install.install):
@@ -73,13 +86,6 @@ python = sys.executable python = python.replace("pythonw.exe", "python.exe") # for Windows subprocess.call([python, "generate_user_files.py"]) - - -extra_deps.update(script_deps) -# Add script dependencies as test dependencies, -# so scripts can be compiled in test suite. -if 'PYSETUP_TEST_EXTRAS' in os.environ: - test_deps += list(itertools.chain(*(script_deps.values())))
setup( name='pywikibot',