1111 PYPI_SIMPLE_V1_JSON ,
1212 PYTHON_EGG_FILENAME ,
1313 PYTHON_EGG_SHA256 ,
14+ PYTHON_FIXTURES_URL ,
1415 PYTHON_MD_PROJECT_SPECIFIER ,
1516 PYTHON_MD_PYPI_SUMMARY ,
1617 PYTHON_WHEEL_FILENAME ,
@@ -179,21 +180,26 @@ def test_twine_upload(
179180 pulpcore_bindings ,
180181 python_content_summary ,
181182 python_empty_repo_distro ,
182- python_package_dist_directory ,
183+ http_get ,
184+ tmp_path ,
183185 monitor_task ,
184186):
185187 """Tests that packages can be properly uploaded through Twine."""
188+ packages_url = urljoin (PYTHON_FIXTURES_URL , "packages/" )
189+ for filename in ("pytz-2023.3.tar.gz" , "pytz-2023.3-py2.py3-none-any.whl" ):
190+ with open (tmp_path / filename , "wb" ) as f :
191+ f .write (http_get (urljoin (packages_url , filename )))
192+
186193 repo , distro = python_empty_repo_distro ()
187194 url = urljoin (distro .base_url , "legacy/" )
188- dist_dir , _ , _ = python_package_dist_directory
189195 username , password = "admin" , "password"
190196 subprocess .run (
191197 (
192198 "twine" ,
193199 "upload" ,
194200 "--repository-url" ,
195201 url ,
196- dist_dir / "*" ,
202+ tmp_path / "*" ,
197203 "-u" ,
198204 username ,
199205 "-p" ,
@@ -205,7 +211,7 @@ def test_twine_upload(
205211 tasks = pulpcore_bindings .TasksApi .list (reserved_resources = repo .pulp_href ).results
206212 for task in reversed (tasks ):
207213 t = monitor_task (task .pulp_href )
208- repo_ver_href = t .created_resources [ - 1 ]
214+ repo_ver_href = [ r for r in t .created_resources if "versions" in r ][ 0 ]
209215 summary = python_content_summary (repository_version = repo_ver_href )
210216 assert summary .present ["python.python" ]["count" ] == 2
211217
@@ -217,7 +223,7 @@ def test_twine_upload(
217223 "upload" ,
218224 "--repository-url" ,
219225 url ,
220- dist_dir / "*" ,
226+ tmp_path / "*" ,
221227 "-u" ,
222228 username ,
223229 "-p" ,
0 commit comments