|
19 | 19 | from twine import exceptions |
20 | 20 | from twine import package as package_file |
21 | 21 |
|
| 22 | +from . import helpers |
| 23 | + |
22 | 24 |
|
23 | 25 | def test_sign_file(monkeypatch): |
24 | 26 | replaced_check_call = pretend.call_recorder(lambda args: None) |
@@ -134,8 +136,59 @@ def test_package_safe_name_is_correct(pkg_name, expected_name): |
134 | 136 | assert package.safe_name == expected_name |
135 | 137 |
|
136 | 138 |
|
| 139 | +def test_metadata_dictionary_keys(): |
| 140 | + """Merge multiple sources of metadata into a single dictionary.""" |
| 141 | + package = package_file.PackageFile.from_filename(helpers.SDIST_FIXTURE, None) |
| 142 | + assert set(package.metadata_dictionary()) == set( |
| 143 | + [ |
| 144 | + # identify release |
| 145 | + "name", |
| 146 | + "version", |
| 147 | + # file content |
| 148 | + "filetype", |
| 149 | + "pyversion", |
| 150 | + # additional meta-data |
| 151 | + "metadata_version", |
| 152 | + "summary", |
| 153 | + "home_page", |
| 154 | + "author", |
| 155 | + "author_email", |
| 156 | + "maintainer", |
| 157 | + "maintainer_email", |
| 158 | + "license", |
| 159 | + "description", |
| 160 | + "keywords", |
| 161 | + "platform", |
| 162 | + "classifiers", |
| 163 | + "download_url", |
| 164 | + "supported_platform", |
| 165 | + "comment", |
| 166 | + "md5_digest", |
| 167 | + "sha256_digest", |
| 168 | + "blake2_256_digest", |
| 169 | + # PEP 314 |
| 170 | + "provides", |
| 171 | + "requires", |
| 172 | + "obsoletes", |
| 173 | + # Metadata 1.2 |
| 174 | + "project_urls", |
| 175 | + "provides_dist", |
| 176 | + "obsoletes_dist", |
| 177 | + "requires_dist", |
| 178 | + "requires_external", |
| 179 | + "requires_python", |
| 180 | + # Metadata 2.1 |
| 181 | + "provides_extras", |
| 182 | + "description_content_type", |
| 183 | + # Metadata 2.2 |
| 184 | + "dynamic", |
| 185 | + ] |
| 186 | + ) |
| 187 | + |
| 188 | + |
137 | 189 | @pytest.mark.parametrize("gpg_signature", [(None), (pretend.stub())]) |
138 | | -def test_metadata_dictionary(gpg_signature): |
| 190 | +def test_metadata_dictionary_values(gpg_signature): |
| 191 | + """Pass values from pkginfo.Distribution through to dictionary.""" |
139 | 192 | meta = pretend.stub( |
140 | 193 | name="whatever", |
141 | 194 | version=pretend.stub(), |
@@ -164,6 +217,7 @@ def test_metadata_dictionary(gpg_signature): |
164 | 217 | requires_python=pretend.stub(), |
165 | 218 | provides_extras=pretend.stub(), |
166 | 219 | description_content_type=pretend.stub(), |
| 220 | + dynamic=pretend.stub(), |
167 | 221 | ) |
168 | 222 |
|
169 | 223 | package = package_file.PackageFile( |
@@ -219,6 +273,9 @@ def test_metadata_dictionary(gpg_signature): |
219 | 273 | assert result["provides_extras"] == meta.provides_extras |
220 | 274 | assert result["description_content_type"] == meta.description_content_type |
221 | 275 |
|
| 276 | + # Metadata 2.2 |
| 277 | + assert result["dynamic"] == meta.dynamic |
| 278 | + |
222 | 279 | # GPG signature |
223 | 280 | assert result.get("gpg_signature") == gpg_signature |
224 | 281 |
|
|
0 commit comments