new: simultanously test your code on all platforms
It is now convenient to do test runs that transparently distribute a normal test run to multiple CPUs or processes. You can do local code changes and immediately distribute tests of your choice simultanously on all available platforms and python versions.
A small example. Suppose you have a Python pkg directory containing the typical __init__.py and a test_something.py test file with this content:
import sys, os def test_pathsep(): assert os.sep == "/" def test_platform(): assert sys.platform != "darwin"
Without further ado (no special configuration files, no remote installations) i can now run:
py.test pkg/test_something.py --dist=each --rsyncdir=pkg --tx socket=192.168.1.102:8888 --tx ssh=noco --tx popen//python=python2.4
This will rsync the "pkg" directory to the specified test execution places and then run tests on my windows machine (reachable through the specified socket-connection), my mac laptop (reachable through ssh) and in a local python 2.4 process. Here is the full output of the distributed test run which shows 6 tests (4 passed, 2 failed), i.e. our 2 tests multiplied by 3 platforms. It shows one expected failure like so:
 ssh=noco -- platform darwin, Python 2.5.1-final-0 cwd: /Users/hpk/pyexecnetcache def test_platform(): > assert sys.platform != "darwin" E assert 'darwin' != 'darwin' E + where 'darwin' = sys.platform /Users/hpk/pyexecnetcache/pkg/test_something.py:8: AssertionError
Hope you find the output obvious enough. I’ve written up some docs in the new distributing tests section.
I also just uploaded a 1.0 alpha py lib release so that you might type "easy_install -U py" to get the alpha release (use at your own risk!). Did i mention that it passes all of its >1000 tests on all platforms simultanously? :)
This is all made possible by py.execnet which is the underlying mechanism for instantiating local and remote processes through SSH- or socket servers and executing code in them, without requiring any prior installation on the remote sides. zero installation really means that you only need a working python interpreter, nothing more. You can make use of this functionality without using py.test. In fact, i plan to soon separate py.test and make the py lib smaller and smaller …
so, enjoy, hope it makes as much sense to you as it makes to me :) And hope to see some of you at Pycon … btw, anybody interested to join me for a Drum and Base party thursday night? cheers, holger
Subscribe to comments with RSS.