(tmp_path: Path, flag: str, mocker: MockerFixture)
| 496 | |
| 497 | @pytest.mark.parametrize("flag", ["-r", "--requirement", "-c", "--constraint"]) |
| 498 | def test_req_over_http(tmp_path: Path, flag: str, mocker: MockerFixture) -> None: |
| 499 | is_constraint = flag in {"-c", "--constraint"} |
| 500 | url_open = mocker.patch("tox.tox_env.python.pip.req.file.urlopen", autospec=True) |
| 501 | url_open.return_value.__enter__.return_value = BytesIO(b"-i i\na") |
| 502 | requirements_txt = tmp_path / "req.txt" |
| 503 | requirements_txt.write_text(f"{flag} https://zopefoundation.github.io/Zope/releases/4.5.5/requirements-full.txt") |
| 504 | req_file = RequirementsFile(requirements_txt, constraint=is_constraint) |
| 505 | assert str(req_file) == f"-{'c' if is_constraint else 'r'} {requirements_txt}" |
| 506 | assert vars(req_file.options) == {"index_url": ["i"]} |
| 507 | found = [str(i) for i in req_file.requirements] |
| 508 | assert found == [f"{'-c ' if is_constraint else ''}a"] |
| 509 | # urlopen must be called with a timeout to avoid hanging on slow / unresponsive mirrors |
| 510 | assert url_open.call_args.kwargs.get("timeout") is not None |
| 511 | |
| 512 | |
| 513 | def test_req_over_http_has_req(tmp_path: Path, mocker: MockerFixture) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…