[py-dev] [ANN] plugin: pytest-incremental

holger krekel holger at merlinux.eu
Fri Apr 29 20:05:55 CEST 2011


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 actually had never tried pytest-xdist... is there anything that I
> could do to make them compatible?

Many people use it for distributing tests to multiple CPUs (or hosts).
If you just consider the multi-CPU case the main issue is to make
sure the slave processes don't step onto each other when writing
or determining your state information.

> > * i got BSDDB database corruption (i CTRL-Ced the run before)
> I tried hitting CTRL-C at several points and never got a corruption.
> At which point you hit Ctrl-C? before the test execution starts?
> Although I got a bug that it does not detect that not all tests were
> executed and mark them as successful.

Not sure i can help with reproducing it.
> > * can you add an example of a project layout
> The plugin is supposed to work with any project layout...

ok ...

> > and what one would call wrt to watch_pkg?
> By default it will look for changes in all python modules that pass
> through py.test collection. This way doesnt work well when you try to
> run tests from a single file like:
> $ py.test  tests/test_foo.py
> 
> If you try to use the plugin like this it will give an error message
> saying that you must specify watch_pkg. lets say you have the folders:
>  /tests
>  /my_lib
> 
> you should call
> $ py.test --incremental --watch-pkg my_lib tests/test_foo.py
> (no need to pass the package of the test file itself)
> 
> It can also be used in case you want to watch for changes in modules
> that are in another project. for example if you are testing pytest and
> want to check for changes in dependencies from your "py" package.
> $ py.test --incremental --watch-pkg my_lib --watch-pkg ../py-trunk/py

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.

> > I guess things don't work for me on pytest itself because
> > it has a plugin-based dynamic namespace construction/imports
> > so your AST scanning method does not really see the deps.
> > A different method would be to try to record imports
> > during the import and running of a test.  Myself, i also
> > experimented with specifying dependencies manually at
> > some point which also solves the issue when invoking
> > shell commands provided a project - i guess those
> > would not naturally be found by your scanner.
> >
> Yes. There is also the problem of dependencies on text files (or any
> other non-python files).
> I think dependencies should really be defined by the user, this AST
> scanner should be just one way of doing it that works out of the box
> for most projects.

Right.  Do you plan to implement a manual way to specify deps
for your plugin?

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.

best,
holger

> Regards,
>   Eduardo
> 



More information about the Pytest-dev mailing list