jenkins-bot has submitted this change and it was merged.

Change subject: Fixups for py3 nosetests
......................................................................


Fixups for py3 nosetests

- only install unittest2 on 2.6 travis builds
- function.func_name has become function.__name__
- use python module six for script_tests metaclass

Change-Id: I9fcded1921048f9570aca4c03d4b730f5b8680de
---
M .travis.yml
M pywikibot/tools.py
M tests/script_tests.py
3 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, but someone else must approve
  Merlijn van Deen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.travis.yml b/.travis.yml
index 1439265..b54adcc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,8 @@
   - sudo apt-get install -y python-imaging-tk liblua5.1-dev
 
 install:
-  - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ordereddict; fi
+  - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ordereddict 
unittest2; fi
+  - pip install six
   - mkdir ~/.pywikibot
 
   - touch ~/.pywikibot/user-config.py
@@ -27,8 +28,6 @@
   - cd externals/httplib2
   - python setup.py install
   - cd ../..
-
-  - pip install unittest2
 
   - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then export USE_NOSE=1; fi
 
diff --git a/pywikibot/tools.py b/pywikibot/tools.py
index fb8628f..61c5b7a 100644
--- a/pywikibot/tools.py
+++ b/pywikibot/tools.py
@@ -337,7 +337,11 @@
     class Wrapper(object):
         def __init__(self, function, source, target):
             self._function = function
-            self.parameters = {'new': function.func_name,
+            if hasattr(function, '__name__'):
+                func_name = function.__name__
+            else:
+                func_name = function.func_name
+            self.parameters = {'new': func_name,
                                'target': target,
                                'source': source}
             self.warning = ('{source}{new} is DEPRECATED, use {target}{new} '
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 32073de..9287a01 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -335,6 +335,10 @@
             os.environ['PYWIKIBOT2_DIR'] = self.old_pywikibot_dir
 
 
+if sys.version_info[0] > 2:
+    import six
+    TestScript = six.add_metaclass(TestScriptMeta)(TestScript)
+
 if __name__ == '__main__':
     try:
         unittest.main()

-- 
To view, visit https://gerrit.wikimedia.org/r/156247
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9fcded1921048f9570aca4c03d4b730f5b8680de
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to