Other plugin breaking usage of pytest-cache
Reference issue: https://github.com/ansible/pytest-mp/issues/18 tl;dr Using the pytest-mp plugin breaks the collection/recording of failed tests in the lastfailed cache. 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? Thanks! Elijah DeLee ------------------ Quality Engineer Red Hat
Hi Elijah, On Thu, May 16, 2019 at 6:29 PM Elijah DeLee <kdelee@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.p... [2]: https://github.com/pytest-dev/pytest/blob/master/src/_pytest/cacheprovider.p... Cheers, Bruno
Great, thanks for the leads! I will let you know if I make progress On Thu, May 16, 2019 at 5:40 PM Bruno Oliveira <nicoddemus@gmail.com> wrote:
Hi Elijah,
On Thu, May 16, 2019 at 6:29 PM Elijah DeLee <kdelee@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.p... [2]: https://github.com/pytest-dev/pytest/blob/master/src/_pytest/cacheprovider.p...
Cheers, Bruno
-- Elijah DeLee ------------------ Quality Engineer
participants (2)
-
Bruno Oliveira -
Elijah DeLee