Last modified: 2014-08-07 14:30:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T71183, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69183 - tox runs all tests (including manual ones)
tox runs all tests (including manual ones)
Status: NEW
Product: Analytics
Classification: Unclassified
Wikimetrics (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-06 14:01 UTC by nuria
Modified: 2014-08-07 14:30 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description nuria 2014-08-06 14:01:59 UTC
tox runs all tests (including manual ones).

We should make sure that when running tox the tests on the manual directory are not run, behaviour should be the same than running ./scripts/test
Comment 1 Antoine "hashar" Musso (WMF) 2014-08-07 07:40:42 UTC
tox is just a wrapper around virtualenv, it then execute a given command. In this case 'nosetests'.  Good news, nosetests let one flag tests with an attribute which can then be included/excluded at will using  --attr=.

I discussed about it with Pywikibot folks, they have unit tests and tests that target the production site.   We wanted to prevent running tests again a site.  What they ended up with is a base class for each kind of tests that adds an attribute and let them skip tests running against a site.

Some magic code at: https://gerrit.wikimedia.org/r/#/c/151604/4/tests/utils.py


You could go with a ManualTestCase that will have an attribute manual_test . Then exclude those tests by running: nosetests --attr='!manual_test'.    That could be added to the commands= stanza in tox.ini

Note, you can create a new tox environment to execute the manual test easily and end up with something like:

 # Default env executed for py26,py27 targets
 # Excludes manual tests
 [testenv]
 ...
 commands = nosetests --attr='!manual_test'

 # Only run manual tests, execute with: tox -emanual_test
 [testenv:manual_test]
 commands = nosetests --attr='manual_test'

 # produce coverage report
 [testenv:cover]
 commands = nosetests --attr='!manual_test' --with-coverage --cover-html
Comment 2 nuria 2014-08-07 09:19:41 UTC
>You could go with a ManualTestCase that will have an attribute manual_test 
Right, we already have such an attribute. I just opened the bug to make sure we do not forget to update our tox config.
Comment 3 Antoine "hashar" Musso (WMF) 2014-08-07 14:30:02 UTC
Great! Let me know if there if you encounter any issue with tox configuration. Will be happy to brainstorm with you.

Also adding relevant Jenkins jobs is quite easy to handle. A short tutorial explains how to amend Jenkins configuration definition at https://www.mediawiki.org/wiki/Continuous_integration/Tutorials/Test_your_python#Editing_Jenkins_configuration

:)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links