jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/462912 )

Change subject: [tests] Run L10N tests on Travis only once for each patch
......................................................................

[tests] Run L10N tests on Travis only once for each patch

- Introduce an new environment variable "PYWIKIBOT_NO_L10N_TESTS"
- Skip L10N tests if "PYWIKIBOT_NO_L10N_TESTS" is set during Travis test
- Reset the new "PYWIKIBOT_NO_L10N_TESTS" environment in Travis test matrix
  for a test which consumes lowest test time

Bug: T191632
Change-Id: I681b77232128d11bb908ff607102dbda255029b6
---
M .travis.yml
M tests/l10n_tests.py
2 files changed, 10 insertions(+), 1 deletion(-)

Approvals:
  Dvorapa: Looks good to me, but someone else must approve
  Framawiki: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.travis.yml b/.travis.yml
index 30e5218..f6bf164 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -122,6 +122,7 @@
 env:
   global:
     - TEST_TIMEOUT=300
+    - PYWIKIBOT_NO_L10N_TESTS=1

   matrix:
     - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT_TEST_PROD_ONLY=1
@@ -145,7 +146,7 @@
     - python: '3.6'
       env: LANGUAGE=zh FAMILY=wpbeta SITE_ONLY=1 
OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org"
     - python: '3.4'
-      env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1
+      env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1 PYWIKIBOT_NO_L10N_TESTS=0
     - python: '2.7'
       env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT_TEST_NO_RC=1
     - python: '3.5'
diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py
index 2e4f26d..6c2ae31 100644
--- a/tests/l10n_tests.py
+++ b/tests/l10n_tests.py
@@ -7,6 +7,8 @@
 #
 from __future__ import absolute_import, division, unicode_literals

+import os
+
 import pywikibot
 from pywikibot import i18n
 from pywikibot.textlib import extract_templates_and_params_regex_simple
@@ -110,6 +112,12 @@
                               .format(package, key))


+def setUpModule():  # noqa: N802
+    """Skip Travis tests if PYWIKIBOT_NO_L10N_TESTS variable is set."""
+    if os.environ.get('PYWIKIBOT_NO_L10N_TESTS', '0') == '1':
+        raise unittest.SkipTest('L10N tests disabled.')
+
+
 if __name__ == '__main__':  # pragma: no cover
     try:
         unittest.main()

--
To view, visit https://gerrit.wikimedia.org/r/462912
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I681b77232128d11bb908ff607102dbda255029b6
Gerrit-Change-Number: 462912
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: Framawiki <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to