Page MenuHomePhabricator

Support Python unit testing using `python setup.py test`
Closed, ResolvedPublic

Description

Extension:EventLogging has a suite of Python unit tests, triggered by running python setup.py test in the server/ subdirectory. It would be great to have those run by Jenkins.

Even better would be to run the test suite under tox http://tox.readthedocs.org/en/latest/. EventLogging provides a tox config file in server/tox.ini, so running 'tox' in servers/ triggers a test run on both Python 2 and Python 3.


Version: wmf-deployment
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=50344

Details

Reference
bz44220

Related Objects

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:31 AM
bzimport set Reference to bz44220.
bzimport added a subscriber: Unknown Object (MLST).

We definitely want to use tox :-] That requires some macro definition in Jenkins Job Builder nothing to worry about.

One possible trouble is that setup.py will install third party libraries from pip and we do not want to blindly install third party stuff and run their code. Will have to be creative there.

(In reply to comment #1)

One possible trouble is that setup.py will install third party libraries from
pip and we do not want to blindly install third party stuff and run their
code.
Will have to be creative there.

Some ideas:

Access package artifacts between multiple tox-runs

http://tox.readthedocs.org/en/latest/example/general.html#artifacts

Access package artifacts between Jenkins jobs

http://tox.readthedocs.org/en/latest/example/jenkins.html#jenkins-artifact-example
We could run a PyPI clone:

Running our own PyPI

http://tox.readthedocs.org/en/latest/config.html#confval-indexserver
http://www.python.org/dev/peps/pep-0381/
http://wiki.python.org/moin/PyPiImplementations
http://brandonkonkle.com/blog/2010/mar/25/creating-personal-pypi-chishop/

Disabling dependency retrieval and enabling sitepackages instead

http://tox.readthedocs.org/en/latest/config.html#confval-sitepackages=True|False
This would allow the tox environments to use Python modules that are globally installed on the Jenkins host. To add additional modules for testing, you'd have to make sure they're in apt and add them via puppet to the integration server.

A few weeks ago I added tox on the integration slaves running in labs. So one can add a tox.ini file and run whatever tests they want :-]