You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and I can't get it to work with a yield statement in my fixture. Pytest is passing the generator function to my test case instead of the resource. Or maybe I've just misunderstood how this is supposed to work. Code is attached - commented out are two forms of the test fixture that seem to work fine. The code that is not commented out produces this kind of error:
$ python3 -m pytest
=================================== test session starts ====================================
platform darwin -- Python 3.3.2 -- pytest-2.3.5
collected 3 items
Original comment byholger krekel (BitBucket: hpk42, GitHub: hpk42):
I am not sure how you got to that readthedocs page, it's not advertised from pytest.org i hope. It's "developer" documentation and its features are only implemented on trunk. See http://pytest.org for the official documentation (pytest-2.3.5 doesn't have yield-syntax for fixtures).
Ah that explains it! I look forward to the new pytest version then. I found the readthedocs from a DuckDuckGo search - should have been more alert to the "latest" in the url...
Originally reported by: Emily Bache (BitBucket: emilybache, GitHub: emilybache)
I'm looking at the documentation:
https://pytest.readthedocs.org/en/latest/fixture.html#fixture-finalization-teardowns
and I can't get it to work with a yield statement in my fixture. Pytest is passing the generator function to my test case instead of the resource. Or maybe I've just misunderstood how this is supposed to work. Code is attached - commented out are two forms of the test fixture that seem to work fine. The code that is not commented out produces this kind of error:
$ python3 -m pytest
=================================== test session starts ====================================
platform darwin -- Python 3.3.2 -- pytest-2.3.5
collected 3 items
test_phonebook.py FFF
========================================= FAILURES =========================================
____________________________________ test_lookup_entry _____________________________________
phonebook = <generator object phonebook at 0x1013e3e60>
test_phonebook.py:27: AttributeError
I expected the one with the yield statement to be interchangable with the one with using 'addfinalizer' and it isn't.
The text was updated successfully, but these errors were encountered: