[py-dev] [ANN] plugin: pytest-incremental
memedough at gmail.com
Mon May 2 12:01:13 CEST 2011
pytest-cov has pytest-xdist support. It was a big reason for writing
it (pytest-cov that is) and holger kindly added to the protocol
between master / slave to allow info to travel that pytest-cov needed.
It is generic so you can use it too.
Have a look at:
At pytest_sessionstart you can check if you are a master process or a
slave process. The most important thing to look for is if config has
slaveinput. If the config has that slaveinput then the process is a
slave. My one work with older pytest and 2.x too. So that give you
answer to non distributed testing process, master process or slave
On master pytest_configure_node you get node. On that put info in the
node.slaveinput and pytest send it to the slave. Look at DistMaster:
On slave at pytest_sessionstart you can get the slaveinput. Look at DistSlave.
On slave at pytest_sessionfinish you put info in that
config.slaveoutput dict to go back to the master.
Then on the master at pytest_testnodedown you get the slaveoutput from
the node that went down.
So then at pytest_sessionfinish on master you know all slaves have
finished and sent back info that been collected by master so can do
stuff with it.
Feel free to use anything from pytest-cov if useful for you.
On 2 May 2011 13:33, Eduardo Schettino <schettino72 at gmail.com> wrote:
> On Sat, Apr 30, 2011 at 2:05 AM, holger krekel <holger at merlinux.eu> wrote:
>> On Fri, Apr 29, 2011 at 21:54 +0800, Eduardo Schettino wrote:
>>> On Fri, Apr 29, 2011 at 8:00 PM, holger krekel <holger at merlinux.eu> wrote:
>>> > * it's not compatible with pytest-xdist, is it?
> I gave it a try... Right now it is definitely not compatible.
> In the plugin test results are saved internally on
> pytest_runtest_makereport and processed at pytest_sessionfinish. I
> could see 2 issues:
> 1) pytest_sessionfinish is called once for every subprocess and once
> for the main process. So on sessionfinish I need to detect if it is a
> subprocess and send the result to the runner in the main process. In
> the main process it would work as it is today. Any clues how to that?
> I looked into junitxml plugin but it seems it does not work together
> with xdist also.
> 2) pytest_runtest_makereport when using xdist "call.result" is None
> (or not defined) when the test fails. I guess this is a bug on xdist.
>> ok, now it's clear that one need to specify file system paths.
>> Throughout the python world "--XYZ-pkg" might mean a module
>> import path like "os.path" or a filesystem path. Maybe good
>> to mention this in the help string for the option - i'd probably
>> rather call it "--watch-path" to disambiguate.
> thanks. fixed.
>> Right. Do you plan to implement a manual way to specify deps
>> for your plugin?
> I could do that, but I don't know how :) I will join the py.test IRC
> so we can talk about it.
> I've been thinking in going the other way. doit calling pytest instead
> of pytest calling doit in a plugin. I've done that before.. the
> problem is that I am not sure it can be done without losing all the
> features from py.test runner.
>> sidenote: you may want to announce the next release of the plugin
>> also to the TIP (testing in python) list -
>> http://lists.idyll.org/listinfo/testing-in-python -
>> a number of people are rather following there rather than here.
> I announced there. this thread was my motivation to write the plugin
> py-dev mailing list
> py-dev at codespeak.net
More information about the Pytest-dev