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

Eduardo Schettino schettino72 at gmail.com
Fri Apr 29 15:54:27 CEST 2011


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?

> * 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.

> * can you add an example of a project layout
The plugin is supposed to work with any project layout...

> 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

>
> 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.

Regards,
  Eduardo



More information about the Pytest-dev mailing list