[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: tests: move random name generation helper

2016-09-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: tests: move random name generation helper
..


tests: move random name generation helper

Move to testwikidata so that it can be used by other tests.

Change-Id: Ia97eb40f74c6df3aa1b81bcaf74ad8258b4c2dad
Signed-off-by: Loic Dachary 
---
M tests/test_bot.py
M tests/wikidata.py
2 files changed, 9 insertions(+), 5 deletions(-)

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



diff --git a/tests/test_bot.py b/tests/test_bot.py
index ff2c70f..a9dbba9 100644
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -17,8 +17,6 @@
 #
 import argparse
 import logging
-import random
-import string
 from datetime import date
 
 import pywikibot
@@ -96,9 +94,7 @@
 dry_run=False,
 verification_delay=30,
 ))
-name = ''.join(random.choice(
-string.ascii_lowercase) for _ in range(16))
-item = bot.__getattribute__('Q_' + name)
+item = bot.__getattribute__('Q_' + TestWikidata.random_name())
 claim = pywikibot.Claim(bot.site,
 bot.P_source_code_repository,
 0)
diff --git a/tests/wikidata.py b/tests/wikidata.py
index 1e46eea..a74a898 100644
--- a/tests/wikidata.py
+++ b/tests/wikidata.py
@@ -14,6 +14,9 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see .
 #
+import random
+import string
+
 import pywikibot
 from pywikibot.data import api
 
@@ -25,3 +28,8 @@
 api.LoginManager(site=site,
  user="FLOSSbotCI",
  password="yosQuepacAm2").login()
+
+@staticmethod
+def random_name():
+return ''.join(random.choice(string.ascii_lowercase)
+   for _ in range(16))

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia97eb40f74c6df3aa1b81bcaf74ad8258b4c2dad
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: tests: move random name generation helper

2016-09-20 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311666

Change subject: tests: move random name generation helper
..

tests: move random name generation helper

Move to testwikidata so that it can be used by other tests.

Change-Id: Ia97eb40f74c6df3aa1b81bcaf74ad8258b4c2dad
Signed-off-by: Loic Dachary 
---
M tests/test_bot.py
M tests/wikidata.py
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/66/311666/1

diff --git a/tests/test_bot.py b/tests/test_bot.py
index ff2c70f..a9dbba9 100644
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -17,8 +17,6 @@
 #
 import argparse
 import logging
-import random
-import string
 from datetime import date
 
 import pywikibot
@@ -96,9 +94,7 @@
 dry_run=False,
 verification_delay=30,
 ))
-name = ''.join(random.choice(
-string.ascii_lowercase) for _ in range(16))
-item = bot.__getattribute__('Q_' + name)
+item = bot.__getattribute__('Q_' + TestWikidata.random_name())
 claim = pywikibot.Claim(bot.site,
 bot.P_source_code_repository,
 0)
diff --git a/tests/wikidata.py b/tests/wikidata.py
index 1e46eea..a74a898 100644
--- a/tests/wikidata.py
+++ b/tests/wikidata.py
@@ -14,6 +14,9 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see .
 #
+import random
+import string
+
 import pywikibot
 from pywikibot.data import api
 
@@ -25,3 +28,8 @@
 api.LoginManager(site=site,
  user="FLOSSbotCI",
  password="yosQuepacAm2").login()
+
+@staticmethod
+def random_name():
+return ''.join(random.choice(string.ascii_lowercase)
+   for _ in range(16))

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia97eb40f74c6df3aa1b81bcaf74ad8258b4c2dad
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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