jenkins-bot has submitted this change and it was merged.

Change subject: travis: Use pytest-attrib for SITE_ONLY=1 jobs
......................................................................


travis: Use pytest-attrib for SITE_ONLY=1 jobs

Earlier, some travis builds used nose because there was no equivalent
of nose-attrib. Now, the plugin pytest-attrib has been created, so
we use this instead.

Now all our travis builds can use pytest instead of nose.

Bug: T135659
Change-Id: I81a9823e803bbf237f4aa65e9c1ba6ae812514ef
---
M .travis.yml
M dev-requirements.txt
2 files changed, 18 insertions(+), 13 deletions(-)

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



diff --git a/.travis.yml b/.travis.yml
index 400862f..2a57533 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,10 +30,14 @@
   # Instead install requests in the before_script step below.
   - if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then rm requirements.txt ; fi
 
-  - if [[ "$SITE_ONLY" == '1' ]]; then
-      export USE_NOSE=1 ;
-    elif [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then
+  # When the env variable USE_NOSE or USE_PYTEST is set, the appropriate
+  # tool is used, else PYTEST is taken as the default
+  - if [[ "$PYSETUP_TEST_EXTRAS" != '1' && "$USE_NOSE" != '1' && "$USE_PYTEST" 
!= '1' ]]; then
       export USE_PYTEST=1 ;
+    fi
+
+  - if [[ "$SITE_ONLY" == '1' ]]; then
+      echo "Running site tests only code ${LANGUAGE} on family ${FAMILY}" ;
     fi
 
   - export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1`
@@ -95,14 +99,16 @@
   - if [[ "$USE_NOSE" == "1" ]]; then
       nosetests --version ;
       if [[ "$SITE_ONLY" == "1" ]]; then
-        echo "Running site tests only code ${LANGUAGE} on family ${FAMILY}" ;
         python setup.py nosetests --tests tests --verbosity=2 -a 
"family=$FAMILY,code=$LANGUAGE" --with-trim --with-coverage --cover-package=. ;
       else
         python setup.py nosetests --tests tests --verbosity=2 --with-trim 
--with-coverage --cover-package=. ;
       fi ;
     elif [[ "$USE_PYTEST" == "1" ]]; then
-      pip install --upgrade pytest-runner pytest-cov pytest-timeout 
"pytest>=2.8.0" ;
-      python setup.py pytest --addopts="-vvv -s --timeout=300 --cov=." ;
+      if [[ "$SITE_ONLY" == "1" ]]; then
+        python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT 
--cov=. -a \"family=='$FAMILY' and code=='$LANGUAGE'\"" ;
+      else
+        python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT 
--cov=." ;
+      fi
     else
       coverage run setup.py test ;
     fi
@@ -117,6 +123,7 @@
     # the github repository 'wikimedia/pywikibot-core'.
     # See http://docs.travis-ci.com/user/encryption-keys/ for more information.
     - secure: 
kofInMlisiTBt9o/Ustc/vySlkKfxGzGCX2LwA1D2waym8sDTS0o5gMJ5LsrT/BUKwZbe1vLozPHqZrrkQvsdTml+DpZuotzdILs0m0f3BUoexEC6OON5IDljuxFyETrD1Ug44ih5Mc4lVFOdTcBzg501ZmswGwQrBvg/OyEFfE=
+    - TEST_TIMEOUT: 300
 
   matrix:
     - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 7bbac29..baed441 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -2,13 +2,11 @@
 #
 unittest2==0.8.0 ; python_full_version < '2.7.3'
 
-pytest
-# These are used by only some Travis builds
-# pytest-timeout needs >=2.8.0
-# pytest>=2.8.0
-# pytest-timeout
-# pytest-runner
-# pytest-cov
+pytest>=2.8.0
+pytest-timeout
+pytest-runner
+pytest-cov
+pytest-attrib
 
 six
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I81a9823e803bbf237f4aa65e9c1ba6ae812514ef
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: AbdealiJK <[email protected]>
Gerrit-Reviewer: AbdealiJK <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to