|
13 | 13 |
|
14 | 14 | import packvers
|
15 | 15 | import pytest
|
| 16 | +from commoncode.system import on_mac |
16 | 17 | from commoncode.testcase import FileDrivenTesting
|
17 | 18 | from packvers.requirements import Requirement
|
18 | 19 |
|
|
26 | 27 | from python_inspector.resolution import parse_reqs_from_setup_py_insecurely
|
27 | 28 | from python_inspector.utils_pypi import PYPI_PUBLIC_REPO
|
28 | 29 | from python_inspector.utils_pypi import Environment
|
| 30 | +from python_inspector.utils_pypi import PypiSimpleRepository |
29 | 31 |
|
30 | 32 | setup_test_env = FileDrivenTesting()
|
31 | 33 | setup_test_env.test_data_dir = os.path.join(os.path.dirname(__file__), "data")
|
@@ -130,6 +132,35 @@ def test_get_resolved_dependencies_with_tilde_requirement_using_json_api():
|
130 | 132 | ]
|
131 | 133 |
|
132 | 134 |
|
| 135 | +@pytest.mark.online |
| 136 | +@pytest.mark.skipif(on_mac, reason="torch is only available for linux and windows.") |
| 137 | +def test_get_resolved_dependencies_for_version_containing_local_version_identifier(): |
| 138 | + req = Requirement("torch==2.0.0+cpu") |
| 139 | + req.is_requirement_resolved = True |
| 140 | + _, plist = get_resolved_dependencies( |
| 141 | + requirements=[req], |
| 142 | + environment=Environment( |
| 143 | + python_version="310", |
| 144 | + operating_system="linux", |
| 145 | + ), |
| 146 | + repos=[ |
| 147 | + PypiSimpleRepository(index_url="https://download.pytorch.org/whl/cpu", credentials=None) |
| 148 | + ], |
| 149 | + as_tree=False, |
| 150 | + ) |
| 151 | + |
| 152 | + assert plist == [ |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + "pkg:pypi/[email protected]%2Bcpu", |
| 160 | + |
| 161 | + ] |
| 162 | + |
| 163 | + |
133 | 164 | @pytest.mark.online
|
134 | 165 | def test_without_supported_wheels():
|
135 | 166 | req = Requirement("autobahn==22.3.2")
|
|
0 commit comments