11from __future__ import annotations
22import filecmp
3- import hashlib
43import json
54from pathlib import Path
65from types import TracebackType
@@ -324,19 +323,19 @@ def test_utf8_declarations(content_type: str, body_decl: bytes) -> None:
324323 method = responses .GET ,
325324 url = "https://test.nil/simple/project/" ,
326325 body = body_decl
327- + b'<a href="../files/project-0.1.0-p\xC3 \xBF 42 -none-any.whl">project-0.1.0-p\xC3 \xBF 42 -none-any.whl</a>' ,
326+ + b'<a href="../files/project-0.1.0-p\xc3 \xbf 42 -none-any.whl">project-0.1.0-p\xc3 \xbf 42 -none-any.whl</a>' ,
328327 content_type = content_type ,
329328 )
330329 with PyPISimple ("https://test.nil/simple/" ) as simple :
331330 assert simple .get_project_page ("project" ) == ProjectPage (
332331 project = "project" ,
333332 packages = [
334333 DistributionPackage (
335- filename = "project-0.1.0-p\xFF 42 -none-any.whl" ,
334+ filename = "project-0.1.0-p\xff 42 -none-any.whl" ,
336335 project = "project" ,
337336 version = "0.1.0" ,
338337 package_type = "wheel" ,
339- url = "https://test.nil/simple/files/project-0.1.0-p\xFF 42 -none-any.whl" ,
338+ url = "https://test.nil/simple/files/project-0.1.0-p\xff 42 -none-any.whl" ,
340339 digests = {},
341340 requires_python = None ,
342341 has_sig = None ,
@@ -371,19 +370,19 @@ def test_latin2_declarations(content_type: str, body_decl: bytes) -> None:
371370 method = responses .GET ,
372371 url = "https://test.nil/simple/project/" ,
373372 body = body_decl
374- + b'<a href="../files/project-0.1.0-p\xC3 \xBF 42 -none-any.whl">project-0.1.0-p\xC3 \xBF 42 -none-any.whl</a>' ,
373+ + b'<a href="../files/project-0.1.0-p\xc3 \xbf 42 -none-any.whl">project-0.1.0-p\xc3 \xbf 42 -none-any.whl</a>' ,
375374 content_type = content_type ,
376375 )
377376 with PyPISimple ("https://test.nil/simple/" ) as simple :
378377 assert simple .get_project_page ("project" ) == ProjectPage (
379378 project = "project" ,
380379 packages = [
381380 DistributionPackage (
382- filename = "project-0.1.0-p\u0102 \u017C 42 -none-any.whl" ,
381+ filename = "project-0.1.0-p\u0102 \u017c 42 -none-any.whl" ,
383382 project = "project" ,
384383 version = "0.1.0" ,
385384 package_type = "wheel" ,
386- url = "https://test.nil/simple/files/project-0.1.0-p\u0102 \u017C 42 -none-any.whl" ,
385+ url = "https://test.nil/simple/files/project-0.1.0-p\u0102 \u017c 42 -none-any.whl" ,
387386 digests = {},
388387 requires_python = None ,
389388 has_sig = None ,
@@ -1017,9 +1016,9 @@ def test_get_provenance() -> None:
10171016 digests = {},
10181017 requires_python = None ,
10191018 has_sig = None ,
1020- provenance_sha256 = hashlib . sha256 ( provenance_bytes ). hexdigest () ,
1019+ provenance_url = "https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl.provenance" ,
10211020 )
1022- assert simple .get_provenance (pkg , verify = True ) == provenance
1021+ assert simple .get_provenance (pkg ) == provenance
10231022
10241023
10251024@responses .activate
@@ -1040,6 +1039,7 @@ def test_get_provenance_404() -> None:
10401039 digests = {},
10411040 requires_python = None ,
10421041 has_sig = None ,
1042+ provenance_url = "https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl.provenance" ,
10431043 )
10441044 with pytest .raises (NoProvenanceError ) as excinfo :
10451045 simple .get_provenance (pkg , verify = False )
@@ -1050,29 +1050,5 @@ def test_get_provenance_404() -> None:
10501050 )
10511051 assert (
10521052 str (excinfo .value )
1053- == "No . provenance file found for sampleproject-1.2.3-py3-none-any.whl at https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl.provenance"
1053+ == "No provenance file found for sampleproject-1.2.3-py3-none-any.whl at https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl.provenance"
10541054 )
1055-
1056-
1057- @responses .activate
1058- def test_get_provenance_verify_no_digest () -> None :
1059- responses .add (
1060- method = responses .GET ,
1061- url = "https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl.provenance" ,
1062- body = "Does not exist" ,
1063- status = 404 ,
1064- )
1065- with PyPISimple ("https://test.nil/simple/" ) as simple :
1066- pkg = DistributionPackage (
1067- filename = "sampleproject-1.2.3-py3-none-any.whl" ,
1068- project = "sampleproject" ,
1069- version = "1.2.3" ,
1070- package_type = "wheel" ,
1071- url = "https://test.nil/simple/packages/sampleproject-1.2.3-py3-none-any.whl" ,
1072- digests = {},
1073- requires_python = None ,
1074- has_sig = None ,
1075- provenance_sha256 = None ,
1076- )
1077- with pytest .raises (NoDigestsError ):
1078- simple .get_provenance (pkg , verify = True )
0 commit comments