(monkeypatch: pytest.MonkeyPatch)
| 88 | |
| 89 | @pytest.fixture # function scope because it modifies os.environ |
| 90 | def mitm_proxy_server_https(monkeypatch: pytest.MonkeyPatch) -> Generator[MitmProxy]: |
| 91 | proxy = MitmProxy() |
| 92 | url = proxy.start().replace("http://", "https://") |
| 93 | monkeypatch.setenv("http_proxy", url) |
| 94 | monkeypatch.setenv("https_proxy", url) |
| 95 | |
| 96 | try: |
| 97 | yield proxy |
| 98 | finally: |
| 99 | proxy.stop() |
| 100 | |
| 101 | |
| 102 | @pytest.fixture(scope="session") |