File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -340,20 +340,35 @@ def test_fips_metadata_excludes_md5_and_blake2(monkeypatch):
340
340
"read_data, missing_fields" ,
341
341
[
342
342
pytest .param (
343
- b"Metadata-Version: 2 .3\n Name: test-package\n Version: 1.0.0\n " ,
343
+ b"Metadata-Version: 102 .3\n Name: test-package\n Version: 1.0.0\n " ,
344
344
"Name, Version" ,
345
345
id = "unsupported Metadata-Version" ,
346
346
),
347
+ pytest .param (
348
+ b"Metadata-Version: 2.3\n Name: UNKNOWN\n Version: UNKNOWN\n " ,
349
+ "Name, Version" ,
350
+ id = "missing Name and Version" ,
351
+ ),
347
352
pytest .param (
348
353
b"Metadata-Version: 2.2\n Name: UNKNOWN\n Version: UNKNOWN\n " ,
349
354
"Name, Version" ,
350
355
id = "missing Name and Version" ,
351
356
),
357
+ pytest .param (
358
+ b"Metadata-Version: 2.3\n Name: UNKNOWN\n Version: 1.0.0\n " ,
359
+ "Name" ,
360
+ id = "missing Name" ,
361
+ ),
352
362
pytest .param (
353
363
b"Metadata-Version: 2.2\n Name: UNKNOWN\n Version: 1.0.0\n " ,
354
364
"Name" ,
355
365
id = "missing Name" ,
356
366
),
367
+ pytest .param (
368
+ b"Metadata-Version: 2.3\n Name: test-package\n Version: UNKNOWN\n " ,
369
+ "Version" ,
370
+ id = "missing Version" ,
371
+ ),
357
372
pytest .param (
358
373
b"Metadata-Version: 2.2\n Name: test-package\n Version: UNKNOWN\n " ,
359
374
"Version" ,
Original file line number Diff line number Diff line change @@ -118,6 +118,6 @@ def dispatch(argv: List[str]) -> Any:
118
118
119
119
configure_output ()
120
120
121
- main = registered_commands [args .command ].load () # type: ignore[no-untyped-call] # python/importlib_metadata#288 # noqa: E501
121
+ main = registered_commands [args .command ].load ()
122
122
123
123
return main (args .args )
Original file line number Diff line number Diff line change 16
16
import re
17
17
import zipfile
18
18
from typing import List , Optional
19
+ from typing import cast as type_cast
19
20
20
21
from pkginfo import distribution
21
22
@@ -87,5 +88,7 @@ def parse(self, data: bytes) -> None:
87
88
super ().parse (data )
88
89
89
90
fp = io .StringIO (data .decode ("utf-8" , errors = "replace" ))
91
+ # msg is ``email.message.Message`` which is a legacy API documented
92
+ # here: https://docs.python.org/3/library/email.compat32-message.html
90
93
msg = distribution .parse (fp )
91
- self .description = msg .get_payload ()
94
+ self .description = type_cast ( str , msg .get_payload () )
You can’t perform that action at this time.
0 commit comments