Hi i tried to made my custom mock class for py.test. I want to send mock_data in test, as first param. But py.test recognize it like fixture name, and raise exception. if remove decorator.decorator
using, it losing fixtures in params.
from decorator import decorator
class mocker(object):
...
def __call__(self, func):
def patched(*args, **kwargs):
self.setup_mocks()
return func(self.mock_data, *args, **kwrgs)
return decorator(patched, func)
...
@mocker
def test_some_func(mock_data, some_fixture)
pass
rises it:
def (mock_data, some_fixture)
E fixture 'mock_data' not found
...
Aucun commentaire:
Enregistrer un commentaire