|
9 | 9 | import io |
10 | 10 | import re |
11 | 11 | import tarfile |
| 12 | +import warnings |
12 | 13 | from inspect import cleandoc |
13 | 14 | from pathlib import Path |
14 | 15 | from unittest.mock import Mock |
|
23 | 24 | from setuptools.config import expand, pyprojecttoml, setupcfg |
24 | 25 | from setuptools.config._apply_pyprojecttoml import _MissingDynamic, _some_attrgetter |
25 | 26 | from setuptools.dist import Distribution |
26 | | -from setuptools.errors import InvalidConfigError, RemovedConfigError |
| 27 | +from setuptools.errors import RemovedConfigError |
| 28 | +from setuptools.warnings import SetuptoolsDeprecationWarning |
27 | 29 |
|
28 | 30 | from .downloads import retrieve_file, urls_from_file |
29 | 31 |
|
@@ -178,6 +180,7 @@ def main_tomatoes(): pass |
178 | 180 | license = "mit or apache-2.0" # should be normalized in metadata |
179 | 181 | classifiers = [ |
180 | 182 | "Development Status :: 5 - Production/Stable", |
| 183 | + "Programming Language :: Python", |
181 | 184 | ] |
182 | 185 | """ |
183 | 186 |
|
@@ -324,10 +327,19 @@ def test_license_expression_with_bad_classifier(tmp_path): |
324 | 327 | "README", |
325 | 328 | f"{text}\n \"License :: OSI Approved :: MIT License\"\n]", |
326 | 329 | ) |
327 | | - msg = "License classifier are deprecated.*'License :: OSI Approved :: MIT License'" |
328 | | - with pytest.raises(InvalidConfigError, match=msg): |
| 330 | + msg = "License classifier are deprecated(?:.|\n)*'License :: OSI Approved :: MIT License'" |
| 331 | + with pytest.raises(SetuptoolsDeprecationWarning, match=msg): |
329 | 332 | pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject) |
330 | 333 |
|
| 334 | + with warnings.catch_warnings(): |
| 335 | + warnings.simplefilter("ignore", SetuptoolsDeprecationWarning) |
| 336 | + dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject) |
| 337 | + # Check 'License :: OSI Approved :: MIT License' is removed |
| 338 | + assert dist.metadata.get_classifiers() == [ |
| 339 | + "Development Status :: 5 - Production/Stable", |
| 340 | + "Programming Language :: Python", |
| 341 | + ] |
| 342 | + |
331 | 343 |
|
332 | 344 | class TestLicenseFiles: |
333 | 345 | def base_pyproject(self, tmp_path, additional_text): |
|
0 commit comments