[pytest-dev] Other plugin breaking usage of pytest-cache

Bruno Oliveira nicoddemus at gmail.com
Thu May 16 17:39:56 EDT 2019


Hi Elijah,


On Thu, May 16, 2019 at 6:29 PM Elijah DeLee <kdelee at redhat.com> wrote:

> Reference issue: https://github.com/ansible/pytest-mp/issues/18
>
>
> I'm having trouble knowing where to start looking. Can anyone give me a
> clue at what point the tests get recorded into the cache?
>

The last-failed support is done inside cacheprovider in an implementation
of the pytest_runtest_logreport[1] hook.

The last-failed support works with pytest-xdist, but because there's
special pytest-xdist handling in the pytest_sessionfinish hook[2]; the
"hasattr(config, 'slaveinput')"
is an implementation detail that LFPlugin is using to avoid having the
workers also trying to write to the cache.

If the problem is indeed that the workers of the pytest-mp plugin are
trying to write to the cache at the same time, you can check if that's the
case by inserting a
"slaveinput" attribute into the config object in the workers, and see if
that fixes it.

[1]:
https://github.com/pytest-dev/pytest/blob/master/src/_pytest/cacheprovider.py#L193
[2]:
https://github.com/pytest-dev/pytest/blob/master/src/_pytest/cacheprovider.py#L261

Cheers,
Bruno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20190516/55813abc/attachment.html>


More information about the pytest-dev mailing list