kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
425 stars 34 forks source link

PASSED test, but never awaited coroutine... #19

Closed asmodehn closed 5 years ago

asmodehn commented 5 years ago

One of my travis build got, for some reason :

tests/test_asyncio.py::test_time

  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/_pytest/python.py:166: RuntimeWarning: coroutine 'test_time' was never awaited

    testfunction(**testargs)

However the test PASSED... This should probably FAIL as the test was not run, correct ?

More details at https://travis-ci.org/asmodehn/boken/builds/574739271

Stranger6667 commented 5 years ago

This should probably FAIL as the test was not run, correct ? Currently, there is a warning for it, and the test is considered as skipped - https://github.com/pytest-dev/pytest/blob/master/src/_pytest/python.py#L161

The behavior depends on the pytest version - the coroutine check was added relatively recently and is absent in "4.3.1" version, used in the build. With that pytest version, it is not skipped but passed.

With the recent pytest, there will be a warning about the absence of a plugin that supports test functions as coros (e.g. pytest-asyncio), however, in the build the plugins list is empty:

============================= test session starts ==============================
platform linux -- Python 3.7.1, pytest-4.3.1, py-1.7.0, pluggy-0.8.0
rootdir: /home/travis/build/asmodehn/boken, inifile:
collected 2 items                                                              

The plugin is not registered for some reason, maybe not installed at all or the pytest command is not what pipenv installs:

Installing dependencies from Pipfile…
     ================================ 2/2 — 00:00:05
asmodehn commented 5 years ago

Oh thanks a lot for the explanation ! This makes total sense. I started to pin dependencies versions to limit this kind of problems in the future...

Stranger6667 commented 5 years ago

You are welcome :)