22
33import io
44import json
5+ import re
56import os .path
67import urllib .request
78import zipfile
@@ -35,8 +36,6 @@ def test_make_info_empty_wheel_metadata(tmp_path):
3536 }
3637
3738
38- # todo
39-
4039def test_make_info_full_wheel_metadata (tmp_path ):
4140 filename = str (tmp_path .joinpath ("a-1-py3-none-any.whl" ))
4241 make_wheel (
@@ -67,7 +66,8 @@ def test_make_info_full_wheel_metadata(tmp_path):
6766def test_main_new_package (tmp_path ):
6867 dist = tmp_path .joinpath ("dist" )
6968 dist .mkdir ()
70- make_wheel (dist .joinpath ("a-1-py3-none-any.whl" ), ())
69+ wheel_name = "a-1-py3-none-any.whl"
70+ make_wheel (dist .joinpath (wheel_name ), ())
7171 dest = tmp_path .joinpath ("dest" )
7272
7373 bio = io .BytesIO (b"" )
@@ -82,8 +82,16 @@ def test_main_new_package(tmp_path):
8282
8383 # just some smoke tests about the output
8484 assert dest .joinpath ("packages.json" ).exists ()
85- assert dest .joinpath ("wheels/a-1-py3-none-any.whl" ).exists ()
86- assert dest .joinpath ("simple/a/index.html" ).exists ()
85+ assert dest .joinpath (f"wheels/{ wheel_name } " ).exists ()
86+
87+ sha = "64f7f4664408d711c17ad28c1d3ba7dd155501e67c8632fafc8a525ba3ebc527"
88+
89+ with open (dest .joinpath ("simple/a/index.html" )) as f :
90+ index_html = re .sub (r'\s+' , ' ' , f .read ())
91+ assert f'<a href="http://example.com/wheels/{ wheel_name } #sha256={ sha } " data-core-metadata="sha256={ sha } " >a-1-py3-none-any.whl</a>' in index_html
92+
93+ with open (dest .joinpath (f"wheels/{ wheel_name } .metadata" )) as f :
94+ assert f .read () == f"sha256={ sha } "
8795
8896
8997def test_main_multiple_provide_same_package_first_wins (tmp_path ):
0 commit comments