@@ -15,6 +15,7 @@ def test_requires_as_expected(self) -> None:
1515 z = MemoryZipFile (
1616 {
1717 "foo/__init__.py" : b"" ,
18+ "foo.egg-info/PKG-INFO" : b"\n " ,
1819 "foo.egg-info/requires.txt" : b"""\
1920 a
2021[e]
@@ -36,6 +37,7 @@ def test_basic_metadata(self) -> None:
3637 z = MemoryZipFile (
3738 {
3839 "foo/__init__.py" : b"" ,
40+ "foo.egg-info/PKG-INFO" : b"\n " ,
3941 "foo.egg-info/requires.txt" : b"""\
4042 a
4143[e]
@@ -68,6 +70,7 @@ def test_basic_metadata_absl_py_09(self) -> None:
6870 z = MemoryZipFile (
6971 {
7072 "foo/__init__.py" : b"" ,
73+ "foo.egg-info/PKG-INFO" : b"\n " ,
7174 "foo.egg-info/requires.txt" : b"""\
7275 six
7376
@@ -94,7 +97,7 @@ def test_basic_metadata_absl_py_09(self) -> None:
9497class TarSdistTest (unittest .TestCase ):
9598 def test_requires_as_expected (self ) -> None :
9699 t = MemoryTarFile (
97- ["foo.egg-info/requires.txt" , "foo/__init__.py" ],
100+ ["foo.egg-info/PKG-INFO" , "foo.egg-info/ requires.txt" , "foo/__init__.py" ],
98101 read_value = b"""\
99102 a
100103[e]
@@ -113,7 +116,7 @@ def test_requires_as_expected(self) -> None:
113116
114117 def test_basic_metadata (self ) -> None :
115118 t = MemoryTarFile (
116- ["foo.egg-info/requires.txt" , "foo/__init__.py" ],
119+ ["foo.egg-info/PKG-INFO" , "foo.egg-info/ requires.txt" , "foo/__init__.py" ],
117120 read_value = b"""\
118121 a
119122[e]
@@ -126,3 +129,18 @@ def test_basic_metadata(self) -> None:
126129 bm .reqs ,
127130 )
128131 self .assertEqual ({"e" }, bm .provides_extra )
132+
133+ def test_metadata_fields_from_tar_sdist (self ) -> None :
134+ t = MemoryTarFile (
135+ ["foo.egg-info/PKG-INFO" , "foo/__init__.py" ],
136+ read_value = b"""Requires-Dist: foo\n Version: 1.2.58\n Summary: Some Summary\n Home-page: http://example.com\n Author: Chicken\n Author-email: [email protected] \n Keywords: farm,animals\n Requires-Python: >=3.6\n Description-Content-Type: text/markdown\n """ ,
137+ )
138+ bm = basic_metadata_from_tar_sdist (t ) # type: ignore
139+ self .assertEqual ("1.2.58" , bm .version )
140+ self .assertEqual ("Some Summary" , bm .summary )
141+ self .assertEqual ("http://example.com" , bm .url )
142+ self .assertEqual ("Chicken" , bm .author )
143+ self .
assertEqual (
"[email protected] " ,
bm .
author_email )
144+ self .assertEqual ("farm,animals" , bm .keywords )
145+ self .assertEqual ("text/markdown" , bm .long_description_content_type )
146+ self .assertEqual (None , bm .description )
0 commit comments