Mocker decorators not recognisable by pytest

Bug #1714756 reported by Volans
6
This bug affects 1 person
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_mock.Mocker()
def test_foo(mocked_obj):
    pass

@requests_mock.Mocker()
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:

https://github.com/pytest-dev/pytest/issues/2749

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.