Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

conftest.py 512 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  1. import pytest
  2. import requests_mock
  3. import os
  4. #"Error: 'Session' object has no attribute 'request'""
  5. #@pytest.fixture(autouse=True)
  6. # def no_requests(monkeypatch):
  7. # monkeypatch.delattr("requests.sessions.Session.request")
  8. @pytest.fixture
  9. def request_mocker(request):
  10. """
  11. :param request: pytest request object for cleaning up.
  12. :return: Returns instance of requests mocker used to mock HTTP calls.
  13. """
  14. m = requests_mock.Mocker()
  15. m.start()
  16. request.addfinalizer(m.stop)
  17. return m
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...