[py-dev] hook ideas for better use/abuse of txspecs and distribution

holger krekel holger at merlinux.eu
Wed Jul 22 11:55:58 CEST 2009


Hey Ronny, 

maybe it's good to also state your overall goal: running 
tests in virtualenv-environments with different packages
pre-installed. 

On Wed, Jul 22, 2009 at 09:51 +0200, Ronny Pfannschmidt wrote:
> Hi,
> 
> i propose 2 new hooks to deal with more intresting aspects of test
> distribution and txspecs
> 
> 1. pytest_generate_gateways(config/session) -> list of execnet gateways
> 
> this hook is supposed to generate the execnet gateways for test
> execution
> 
> the default implementation is supposed to just do what py.test currently
> does

probably rather a hook for setting a single gateway

    pytest_makegateway(txspec) -> execnet gateway 

because management of multiple nodes and their setup
is its own concern - some nodes might not come up etc.

In the --tx specifciation one could say e.g. 

    popen//python=python2.5//virtualenv=docutils-0.5,mercurial-1.2

and a pytest_virtualenv plugin could take it, call virtualenv
and eventually start up a gateway with the venv/bin/python. 
 
> howevers users should be free to generate own gateways to custom set up
> things like virtualenvs on local or remote computers and be able to
> combine txspecs with own options

To get started, i would first try to get things working with
popen, then extend to handle remote places - would you want
to automatically install virtualenv there and/or require 
setuptools, btw?   
 
> 2. pytest_select_gateways(test, list of gateways) -> list of gateways
> 
> this hook is supposed to select the gateways each test is supposed to
> run on

something like this could make sense.  It's a second step, i'd think, 
though. 

Can you imagine working on a branch to try implement these hooks? 
I am willing to help/review.  

> the default implementation should pass a test to all of them or
> distribute them reasonable
> the api for this one probably needs a few more idea since i think my
> initial proposal is not adequate for all uses

yes, working from concrete uses (a pytest_virtualenv
plugin) makes sense.  

best,
holger



More information about the Pytest-dev mailing list