[MediaWiki-commits] [Gerrit] labs...stashbot[master]: Support Python3

2017-02-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/338046 )

Change subject: Support Python3
..


Support Python3

Make the code run on both python2 and python3.

Change-Id: Iac98ff3363ca60474a9df796593ae54dab356391
---
M stashbot/mediawiki.py
M tox.ini
2 files changed, 14 insertions(+), 4 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/stashbot/mediawiki.py b/stashbot/mediawiki.py
index 087c383..e64da49 100644
--- a/stashbot/mediawiki.py
+++ b/stashbot/mediawiki.py
@@ -17,7 +17,10 @@
 # this program.  If not, see .
 
 import mwclient
-import urlparse
+try:
+from urlparse import urlparse
+except ImportError:
+from urllib.parse import urlparse
 
 
 class Client(object):
@@ -38,7 +41,7 @@
 consumer_token=None, consumer_secret=None,
 access_token=None, access_secret=None
 ):
-parts = urlparse.urlparse(url)
+parts = urlparse(url)
 host = parts.netloc
 if parts.scheme != 'https':
 host = (parts.scheme, parts.netloc)
diff --git a/tox.ini b/tox.ini
index 0af9877..dcc3996 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,20 @@
 [tox]
 minversion = 1.6
 skipsdist = True
-envlist = py2, flake8
+envlist = py2, py3, flake8
 
-[testenv]
+[testenv:py2]
 basepython = python2
 commands =
   nosetests --with-doctest --doctest-tests -v --detailed-errors
+deps =
+  -r{toxinidir}/requirements.txt
+  nose
 
+[testenv:py3]
+basepython = python3
+commands =
+  nosetests --with-doctest --doctest-tests -v --detailed-errors
 deps =
   -r{toxinidir}/requirements.txt
   nose

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac98ff3363ca60474a9df796593ae54dab356391
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/stashbot
Gerrit-Branch: master
Gerrit-Owner: BryanDavis 
Gerrit-Reviewer: BryanDavis 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] labs...stashbot[master]: Support Python3

2017-02-15 Thread BryanDavis (Code Review)
BryanDavis has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338046 )

Change subject: Support Python3
..

Support Python3

Make the code run on both python2 and python3.

Change-Id: Iac98ff3363ca60474a9df796593ae54dab356391
---
M stashbot/mediawiki.py
M tox.ini
2 files changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/stashbot 
refs/changes/46/338046/1

diff --git a/stashbot/mediawiki.py b/stashbot/mediawiki.py
index 087c383..e64da49 100644
--- a/stashbot/mediawiki.py
+++ b/stashbot/mediawiki.py
@@ -17,7 +17,10 @@
 # this program.  If not, see .
 
 import mwclient
-import urlparse
+try:
+from urlparse import urlparse
+except ImportError:
+from urllib.parse import urlparse
 
 
 class Client(object):
@@ -38,7 +41,7 @@
 consumer_token=None, consumer_secret=None,
 access_token=None, access_secret=None
 ):
-parts = urlparse.urlparse(url)
+parts = urlparse(url)
 host = parts.netloc
 if parts.scheme != 'https':
 host = (parts.scheme, parts.netloc)
diff --git a/tox.ini b/tox.ini
index 0af9877..dcc3996 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,20 @@
 [tox]
 minversion = 1.6
 skipsdist = True
-envlist = py2, flake8
+envlist = py2, py3, flake8
 
-[testenv]
+[testenv:py2]
 basepython = python2
 commands =
   nosetests --with-doctest --doctest-tests -v --detailed-errors
+deps =
+  -r{toxinidir}/requirements.txt
+  nose
 
+[testenv:py3]
+basepython = python3
+commands =
+  nosetests --with-doctest --doctest-tests -v --detailed-errors
 deps =
   -r{toxinidir}/requirements.txt
   nose

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac98ff3363ca60474a9df796593ae54dab356391
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/stashbot
Gerrit-Branch: master
Gerrit-Owner: BryanDavis 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits