jenkins-bot merged this change.

View Change

Approvals: Zhuyifei1999: Looks good to me, but someone else must approve Dvorapa: Looks good to me, approved jenkins-bot: Verified
Rename PYWIKIBOT2_TEST_* environment variables to PYWIKIBOT_TEST_*

Since these variable are only used by developers for testing purposes
I don't think a deprecation period is required.

Also rename PYWIKIBOT2_USERNAME to PYWIKIBOT_USERNAME. It is only
used in .travis.yml file.

Bug: T184674
Change-Id: I93e3d6c9f228bab9d0390684d5348eea0f7726ba
---
M .travis.yml
M tests/README.rst
M tests/aspects.py
M tests/script_tests.py
M tests/tk_tests.py
5 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 96f8a27..479b58b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -44,7 +44,7 @@
- chmod 700 ~/.python-eggs

- if [[ "$GITHUB_USER" != "wikimedia" ]]; then
- export PYWIKIBOT2_TEST_WRITE_FAIL=1 ;
+ export PYWIKIBOT_TEST_WRITE_FAIL=1 ;
fi

before_script:
@@ -67,21 +67,21 @@
python -m generate_family_file 'http://'$LANGUAGE'.wikisource.beta.wmflabs.org/' 'wsbeta' 'y' ;
fi

- - python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/ -family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT2_USERNAME"
+ - python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/ -family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT_USERNAME"

- - if [[ -n "$USER_PASSWORD" && -n "$PYWIKIBOT2_USERNAME" ]]; then
- printf "usernames['wikipedia']['en'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
- printf "usernames['wikipedia']['test'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
- printf "usernames['wikidata']['test'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
- printf "usernames['commons']['commons'] = '%q'\n" "$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
- printf "('%q', '%q')\n" "$PYWIKIBOT2_USERNAME" "$USER_PASSWORD" > ~/.pywikibot/passwordfile ;
+ - if [[ -n "$USER_PASSWORD" && -n "$PYWIKIBOT_USERNAME" ]]; then
+ printf "usernames['wikipedia']['en'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['wikipedia']['test'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['wikidata']['test'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['commons']['commons'] = '%q'\n" "$PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "('%q', '%q')\n" "$PYWIKIBOT_USERNAME" "$USER_PASSWORD" > ~/.pywikibot/passwordfile ;
echo "import os" >> ~/.pywikibot/user-config.py ;
echo "password_file = os.path.expanduser('~/.pywikibot/passwordfile')" >> ~/.pywikibot/user-config.py ;
fi

- if [[ -n "$OAUTH_DOMAIN" ]]; then
- if [[ -n "$OAUTH_PYWIKIBOT2_USERNAME" ]]; then
- printf "usernames['${FAMILY}']['${LANGUAGE}'] = '%q'\n" "$OAUTH_PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
+ if [[ -n "$OAUTH_PYWIKIBOT_USERNAME" ]]; then
+ printf "usernames['${FAMILY}']['${LANGUAGE}'] = '%q'\n" "$OAUTH_PYWIKIBOT_USERNAME" >> ~/.pywikibot/user-config.py ;
fi ;
oauth_token_var="OAUTH_TOKENS_${FAMILY^^}_${LANGUAGE^^}" ;
if [[ -n "${!oauth_token_var}" ]]; then
@@ -124,13 +124,13 @@
- TEST_TIMEOUT=300

matrix:
- - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1
- - LANGUAGE=zh FAMILY=wikisource PYSETUP_TEST_EXTRAS=1 PYWIKIBOT2_TEST_PROD_ONLY=1 PYWIKIBOT2_TEST_NO_RC=1
+ - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT_TEST_PROD_ONLY=1
+ - LANGUAGE=zh FAMILY=wikisource PYSETUP_TEST_EXTRAS=1 PYWIKIBOT_TEST_PROD_ONLY=1 PYWIKIBOT_TEST_NO_RC=1

matrix:
include:
- python: '2.7_with_system_site_packages'
- env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty PYSETUP_TEST_EXTRAS=1 PYWIKIBOT2_TEST_NO_RC=1
+ env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty PYSETUP_TEST_EXTRAS=1 PYWIKIBOT_TEST_NO_RC=1
dist: trusty
sudo: required
addons:
@@ -147,7 +147,7 @@
- python: '3.4'
env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1
- python: '2.7'
- env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT2_TEST_NO_RC=1
+ env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT_TEST_NO_RC=1
- python: '3.5'
env: LANGUAGE=en FAMILY=musicbrainz SITE_ONLY=1
- python: '3.4'
@@ -155,7 +155,7 @@
- python: '3.4'
env: LANGUAGE=test FAMILY=wikidata SITE_ONLY=1
- python: '3.4'
- env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT2_TEST_NO_RC=1
+ env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT_TEST_NO_RC=1
- python: '3.6'
env: LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1

diff --git a/tests/README.rst b/tests/README.rst
index 4699d7b..c201486 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -142,7 +142,7 @@
a username and password to travis:

1. Go to https://travis-ci.org/<username>/pywikibot/settings
-2. Add a new variable named PYWIKIBOT2_USERNAME and a value of a valid
+2. Add a new variable named PYWIKIBOT_USERNAME and a value of a valid
Wikimedia SUL username
3. Add another variable named USER_PASSWORD, with the private password for
the Wikimedia SUL username used in step 2. Check that this
@@ -213,7 +213,7 @@
These 'edit failure' tests are disabled by default. On Travis they are enabled
by default on builds by any other github account except 'wikimedia'.

-To disable 'edit failure' tests, set PYWIKIBOT2_TEST_WRITE_FAIL=0
+To disable 'edit failure' tests, set PYWIKIBOT_TEST_WRITE_FAIL=0

There are also several other 'write' tests which also attempt to perform
write operations successfully. These **will** write to the wikis, and they
@@ -223,7 +223,7 @@
run on travis or appveyor as they require interaction using a terminal. Also
enabling them won't enable 'edit failure' tests.

-To enable 'write' tests, set PYWIKIBOT2_TEST_WRITE=1
+To enable 'write' tests, set PYWIKIBOT_TEST_WRITE=1

Enabling only 'edit failure' tests or 'write' tests won't enable the other tests
automatically.
diff --git a/tests/aspects.py b/tests/aspects.py
index fa21592..5d1e27d 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -581,10 +581,10 @@
Prevent test classes from writing to the site by default.

If class attribute 'write' is -1, the test class is skipped unless
- environment variable PYWIKIBOT2_TEST_WRITE_FAIL is set to 1.
+ environment variable PYWIKIBOT_TEST_WRITE_FAIL is set to 1.

Otherwise the test class is skipped unless environment variable
- PYWIKIBOT2_TEST_WRITE is set to 1.
+ PYWIKIBOT_TEST_WRITE is set to 1.
"""
if issubclass(cls, ForceCacheMixin):
raise Exception(
@@ -597,9 +597,9 @@
site = cls.get_site()

if cls.write == -1:
- env_var = 'PYWIKIBOT2_TEST_WRITE_FAIL'
+ env_var = 'PYWIKIBOT_TEST_WRITE_FAIL'
else:
- env_var = 'PYWIKIBOT2_TEST_WRITE'
+ env_var = 'PYWIKIBOT_TEST_WRITE'

if os.environ.get(env_var, '0') != '1':
raise unittest.SkipTest(
@@ -1014,9 +1014,9 @@

for data in cls.sites.values():
if ('code' in data and data['code'] in ('test', 'mediawiki') and
- 'PYWIKIBOT2_TEST_PROD_ONLY' in os.environ and not dry):
+ 'PYWIKIBOT_TEST_PROD_ONLY' in os.environ and not dry):
raise unittest.SkipTest(
- 'Site code "%s" and PYWIKIBOT2_TEST_PROD_ONLY is set.'
+ 'Site code "%s" and PYWIKIBOT_TEST_PROD_ONLY is set.'
% data['code'])

if 'site' not in data and 'code' in data and 'family' in data:
@@ -1530,7 +1530,7 @@
@classmethod
def setUpClass(cls):
"""Set up test class."""
- if os.environ.get('PYWIKIBOT2_TEST_NO_RC', '0') == '1':
+ if os.environ.get('PYWIKIBOT_TEST_NO_RC', '0') == '1':
raise unittest.SkipTest('RecentChanges tests disabled.')

super(RecentChangesTestCase, cls).setUpClass()
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 22d1593..dbbdc98 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -166,7 +166,7 @@


enable_autorun_tests = (
- os.environ.get('PYWIKIBOT2_TEST_AUTORUN', '0') == '1')
+ os.environ.get('PYWIKIBOT_TEST_AUTORUN', '0') == '1')


def collector(loader=unittest.loader.defaultTestLoader):
@@ -181,7 +181,7 @@

if not enable_autorun_tests:
unittest_print('Skipping execution of auto-run scripts '
- '(set PYWIKIBOT2_TEST_AUTORUN=1 to enable):\n %r'
+ '(set PYWIKIBOT_TEST_AUTORUN=1 to enable):\n %r'
% auto_run_script_list)

tests = (['test__login'] +
@@ -231,7 +231,7 @@
def test_skip_script(self):
raise unittest.SkipTest(
'Skipping execution of auto-run scripts (set '
- 'PYWIKIBOT2_TEST_AUTORUN=1 to enable) "{0}"'
+ 'PYWIKIBOT_TEST_AUTORUN=1 to enable) "{0}"'
.format(script_name))

def testScript(self):
diff --git a/tests/tk_tests.py b/tests/tk_tests.py
index 60b5cb6..be2ad20 100644
--- a/tests/tk_tests.py
+++ b/tests/tk_tests.py
@@ -14,7 +14,7 @@
from tests.aspects import unittest, TestCase, DefaultSiteTestCase


-if os.environ.get('PYWIKIBOT2_TEST_GUI', '0') == '1':
+if os.environ.get('PYWIKIBOT_TEST_GUI', '0') == '1':
if not PY2:
import tkinter as Tkinter
else:
@@ -31,7 +31,7 @@
@classmethod
def setUpClass(cls):
"""Set up test class."""
- if os.environ.get('PYWIKIBOT2_TEST_GUI', '0') != '1':
+ if os.environ.get('PYWIKIBOT_TEST_GUI', '0') != '1':
raise unittest.SkipTest('Tkdialog tests are disabled on Travis-CI')
super(TestTkdialog, cls).setUpClass()

@@ -53,7 +53,7 @@
@classmethod
def setUpClass(cls):
"""Set up test class."""
- if os.environ.get('PYWIKIBOT2_TEST_GUI', '0') != '1':
+ if os.environ.get('PYWIKIBOT_TEST_GUI', '0') != '1':
raise unittest.SkipTest('Tkinter tests are disabled on Travis-CI')
super(TestTkinter, cls).setUpClass()


To view, visit change 449931. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I93e3d6c9f228bab9d0390684d5348eea0f7726ba
Gerrit-Change-Number: 449931
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999@gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)