Mocker decorators not recognisable by pytest
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
requests-mock |
New
|
Undecided
|
Unassigned |
Bug Description
When running the following code with pytest, it passes on Python 2.7 but both tests fail on Python 3.6 with the message "E fixture 'mocked_obj' not found":
#------
import requests_mock
@requests_
def test_foo(
pass
@requests_
class TestFoo(object):
def test_foo(self, mocked_obj):
pass
#------
I've already opened an issue on Pytest side but according to pytest folks it's not possible to recognise the 'mocked_obj' parameter as the one already passed by the decorator because of missing metadata, hence pytest looks for a fixture with that name and fail.
See the pytest issue on GitHub for additional information on the test environments and the related discussion: