I'm making an HTTP GET request using the requests library. For example (truncated):
requests.get("http://123-fake-api.com")
I've written a test following the requests-mock decorator pattern.
import requests
import requests_mock
@requests_mock.Mocker()
def test(m):
m.get("http://123-fake-api.com", text="Hello!")
response = requests.get("http://123-fake-api.com").text
assert response.text == "Hello!"
When I run the test with pytest, I get the following error.
E fixture 'm' not found
Why is the requests-mock decorator throwing a "fixture 'm' not found" error? And how do I resolve it?