Thanks to many of you who have worked on the flake warnings over the last few months, the code base now has zero flakes, and thanks to hashar a 'flake8' job now votes against any changeset which has flakes.
Also, nose tests are also run for every changeset before the code is merged, but only the tests which do not connect to a site, or have network activity. In the test files in tests/* , you will see some are subclasses of NoSiteTestCase , and some have net = True as class attributes. These clues help nose avoid tests which will connect to servers, possibly timing out, etc.
Anyone can run the all tests using nose.
https://nose.readthedocs.org/en/latest/
To run only the tests which are run by jenkins, even without a user-config.py file, use
PYWIKIBOT2_NO_USER_CONFIG=1 nosetests -a "!site,!net"
Le 18/08/2014 17:48, John Mark Vandenberg a écrit :
To run only the tests which are run by jenkins, even without a user-config.py file, use
PYWIKIBOT2_NO_USER_CONFIG=1 nosetests -a "!site,!net"
As an alternative, one can use tox which create virtualenv on the fly and takes care of installing dependencies and executing the proper command.
pip install tox tox
tox -l shows a list of predefined envs that are executed by default:
flake8 # linter flake8-docstrings # pep257 docstring linter py26 # run test command under python 2.6 py27 # same but with python 2.7
More can be found in the tox.ini file, such as 'nose'.
If you only want to execute the flake8:
tox -e flake8
For nose:
tox -e nose
Jenkins uses exactly that, so your setup should match exactly what it runs.
There is a few more details at:
https://www.mediawiki.org/wiki/Continuous_integration/Tutorials/Test_your_py...
Is there a way to make flake8 consider only those files that are tracked in git? I have other untracked files in my core dir and flake8 generates warnings related to such files which are actually out of scope. That would be appreciated.
Thanks Mpaa
On Tue, Aug 19, 2014 at 10:39 AM, Antoine Musso hashar+wmf@free.fr wrote:
Le 18/08/2014 17:48, John Mark Vandenberg a écrit :
To run only the tests which are run by jenkins, even without a user-config.py file, use
PYWIKIBOT2_NO_USER_CONFIG=1 nosetests -a "!site,!net"
As an alternative, one can use tox which create virtualenv on the fly and takes care of installing dependencies and executing the proper command.
pip install tox tox
tox -l shows a list of predefined envs that are executed by default:
flake8 # linter flake8-docstrings # pep257 docstring linter py26 # run test command under python 2.6 py27 # same but with python 2.7
More can be found in the tox.ini file, such as 'nose'.
If you only want to execute the flake8:
tox -e flake8
For nose:
tox -e nose
Jenkins uses exactly that, so your setup should match exactly what it runs.
There is a few more details at:
https://www.mediawiki.org/wiki/Continuous_integration/Tutorials/Test_your_py...
-- Antoine "hashar" Musso
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
pywikipedia-l@lists.wikimedia.org