jenkins-bot has submitted this change and it was merged.
Change subject: Allow github clones to easily run travis builds
......................................................................
Allow github clones to easily run travis builds
The wiki user 'Pywikibot-test' only works on the 'wikimedia'
travis-ci account. This prevents unmodified clones of the
codebase from running tests on travis-ci.
The tests now run according to whatever is in user-config.py,
skipping tests which cant be run.
The default .travis.yml now detects if it is run by the 'wikimedia'
account, and detects if the travis user has a password set.
If a username or password can't be found, the username and password
are not set up, which disables any tests which require a user.
Change-Id: I0f22caaf8b5cd314a196a5e3cc25ae830231ccb5
---
M .travis.yml
1 file changed, 13 insertions(+), 7 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index fe58fc3..5e59a21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,21 +12,27 @@
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ordereddict
unittest2; fi
- pip install six
+ - export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1`
- mkdir ~/.pywikibot
- touch ~/.pywikibot/user-config.py
- echo "import os" >> ~/.pywikibot/user-config.py
- echo "mylang = '$LANGUAGE'" >> ~/.pywikibot/user-config.py
- echo "family = '$FAMILY'" >> ~/.pywikibot/user-config.py
- - echo "usernames['$FAMILY']['$LANGUAGE'] = 'Pywikibot-test'" >>
~/.pywikibot/user-config.py
- - echo "usernames['wikipedia']['en'] = 'Pywikibot-test'" >>
~/.pywikibot/user-config.py
- - echo "usernames['wikipedia']['test'] = 'Pywikibot-test'" >>
~/.pywikibot/user-config.py
- - echo "usernames['wikidata']['test'] = 'Pywikibot-test'" >>
~/.pywikibot/user-config.py
+
- echo "password_file = os.path.expanduser('~/.pywikibot/passwordfile')" >>
~/.pywikibot/user-config.py
+ - touch ~/.pywikibot/passwordfile
+
- echo "max_retries = 2" >> ~/.pywikibot/user-config.py
- - touch ~/.pywikibot/passwordfile
- - echo "('Pywikibot-test', '"$USER_PASSWORD"')" > ~/.pywikibot/passwordfile
+ - if [[ "$GITHUB_USER" == "wikimedia" ]]; then
PYWIKIBOT2_USERNAME="Pywikibot-test"; fi
+
+ - if [[ -n "$USER_PASSWORD" -a -n "$PYWIKIBOT2_USERNAME" ]]; then echo
"usernames['$FAMILY']['$LANGUAGE'] = '$PYWIKIBOT2_USERNAME'" >>
~/.pywikibot/user-config.py; fi
+ - if [[ -n "$USER_PASSWORD" -a -n "$PYWIKIBOT2_USERNAME" ]]; then echo
"usernames['wikipedia']['en'] = '$PYWIKIBOT2_USERNAME'" >>
~/.pywikibot/user-config.py; fi
+ - if [[ -n "$USER_PASSWORD" -a -n "$PYWIKIBOT2_USERNAME" ]]; then echo
"usernames['wikipedia']['test'] = '$PYWIKIBOT2_USERNAME'" >>
~/.pywikibot/user-config.py; fi
+ - if [[ -n "$USER_PASSWORD" -a -n "$PYWIKIBOT2_USERNAME" ]]; then echo
"usernames['wikidata']['test'] = '$PYWIKIBOT2_USERNAME'" >>
~/.pywikibot/user-config.py; fi
+
+ - if [[ -n "$USER_PASSWORD" -a -n "$PYWIKIBOT2_USERNAME" ]]; then echo
"('$PYWIKIBOT2_USERNAME', '$USER_PASSWORD')" > ~/.pywikibot/passwordfile; fi
- cd externals/httplib2
- python setup.py install
@@ -35,7 +41,7 @@
- python -c "import setuptools; print(setuptools.__version__)"
script:
- - if [[ "$USE_NOSE" == "1" ]]; then nosetests -v -a '!site,!net' tests; else
python setup.py test; fi
+ - if [[ "$USE_NOSE" == "1" ]]; then nosetests -v ; else python setup.py
test; fi
env:
global:
--
To view, visit https://gerrit.wikimedia.org/r/152278
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0f22caaf8b5cd314a196a5e3cc25ae830231ccb5
Gerrit-PatchSet: 6
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: Legoktm <[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