changhsinlee/pytest-mock-examples

fixture 'mocker' not found

kevinjyh opened this issue · 2 comments

I am new to pytest.
After "clone github" repo, "pip install -e .", and "pytest --durations=0"
I got the following error messages:
tests/test_mocking_constant_mocker.py, line 6
tests/test_mocking_constant_mocker.py, line 14
tests/test_slow_class.py, line 4
tests/test_slow_function.py, line 12
...
E fixture 'mocker' not found

How can I add pytest fixture'mocker'
ErrorMsgs.txt
?

Try installing pytest-mock manually

pip install pytest-mock

If you're using a venv then the above alone won't work. I needed to install pytest-mock at the user level:

pip install --user pytest-mock

Then this worked for me when running pytest inside my venv.

I wish I could explain why that fixed it 🤔