(mock_pypi_rest_api)
| 40 | |
| 41 | @responses.activate |
| 42 | def test_package_retrieval(mock_pypi_rest_api): |
| 43 | mock_pypi_rest_api(responses) |
| 44 | pkg = package.PypiPackage.from_cached("wheel") |
| 45 | url = "https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl" |
| 46 | |
| 47 | assert pkg.name == "wheel" |
| 48 | assert pkg.source == "pypi" # TODO: add tests for other package options |
| 49 | |
| 50 | with pkg.url2local(url) as location: |
| 51 | assert location.is_file() |
| 52 | file_name = url.split("/")[-1] |
| 53 | assert location.name.endswith(file_name), (location, file_name) |
| 54 | |
| 55 | with tempfile.TemporaryDirectory(prefix="aura_pytest_") as tmp: |
| 56 | downloaded = [x["filename"] for x in pkg.download_release(tmp, packagetype="all", release="0.34.2")] |
| 57 | content = os.listdir(tmp) |
| 58 | |
| 59 | assert "wheel-0.34.2.tar.gz" in downloaded |
| 60 | assert "wheel-0.34.2.tar.gz" in content |
| 61 | assert "wheel-0.34.2-py2.py3-none-any.whl" in downloaded |
| 62 | assert "wheel-0.34.2-py2.py3-none-any.whl" in content |
| 63 | |
| 64 | |
| 65 | @responses.activate |
nothing calls this directly
no test coverage detected