|
40 | 40 | test_list_int, |
41 | 41 | test_list_str |
42 | 42 | ) |
| 43 | +from pytest_regressions.data_regression import DataRegressionFixture |
43 | 44 |
|
44 | 45 | # this package |
45 | 46 | from repo_helper.configuration import * # pylint: disable=wildcard-import |
@@ -309,46 +310,51 @@ def test_import_name_errors(wrong_value, match): |
309 | 310 | import_name.get(wrong_value) |
310 | 311 |
|
311 | 312 |
|
312 | | -def test_classifiers(): |
| 313 | +@pytest.mark.parametrize( |
| 314 | + "config_dict", |
| 315 | + [ |
| 316 | + pytest.param({"classifiers": ["Environment :: Console"]}, id="environment_console"), |
| 317 | + pytest.param({"classifiers": []}, id="empty"), |
| 318 | + pytest.param({"username": "domdfcoding"}, id="not_given_1"), |
| 319 | + pytest.param({}, id="not_given_2"), |
| 320 | + pytest.param({ |
| 321 | + "classifiers": ["Environment :: Console"], |
| 322 | + "python_versions": [3.6, 3.7, 3.8], |
| 323 | + }, |
| 324 | + id="environment_console_simple_versions"), |
| 325 | + pytest.param({ |
| 326 | + "classifiers": ["Environment :: Console"], |
| 327 | + "python_versions": [3.6, 3.7, 3.8, "3.10"], |
| 328 | + }, |
| 329 | + id="environment_console_complex_versions"), |
| 330 | + pytest.param({ |
| 331 | + "classifiers": ["Environment :: Console"], |
| 332 | + "python_versions": [3.7, "3.10", 3.8, 3.6], |
| 333 | + }, |
| 334 | + id="environment_console_unordered_versions"), |
| 335 | + pytest.param({ |
| 336 | + "classifiers": ["Environment :: Console"], |
| 337 | + "python_versions": [3.6, 3.7, 3.8, "pypy3"], |
| 338 | + }, |
| 339 | + id="environment_console_pypy_versions"), |
| 340 | + pytest.param({ |
| 341 | + "classifiers": ["Environment :: Console"], |
| 342 | + "license": "MIT", |
| 343 | + }, |
| 344 | + id="environment_console_license_mit"), |
| 345 | + ] |
| 346 | + ) |
| 347 | +def test_classifiers(config_dict: Dict[str, Any], data_regression: DataRegressionFixture): |
| 348 | + data_regression.check(classifiers.get(config_dict)) |
313 | 349 |
|
314 | | - default_classifiers = [ |
| 350 | + assert classifiers.get() == [ |
315 | 351 | "Operating System :: OS Independent", |
316 | 352 | "Programming Language :: Python", |
317 | 353 | "Programming Language :: Python :: 3 :: Only", |
318 | 354 | "Programming Language :: Python :: 3.6", |
319 | 355 | "Programming Language :: Python :: Implementation :: CPython", |
320 | 356 | ] |
321 | 357 |
|
322 | | - assert classifiers.get({"classifiers": ["Environment :: Console"]}) == [ |
323 | | - "Environment :: Console", |
324 | | - *default_classifiers, |
325 | | - ] |
326 | | - assert classifiers.get({ |
327 | | - "classifiers": ["Environment :: Console"], |
328 | | - "python_versions": [3.6, 3.7, 3.8], |
329 | | - }) == [ |
330 | | - "Environment :: Console", |
331 | | - "Operating System :: OS Independent", |
332 | | - "Programming Language :: Python", |
333 | | - "Programming Language :: Python :: 3 :: Only", |
334 | | - "Programming Language :: Python :: 3.6", |
335 | | - "Programming Language :: Python :: 3.7", |
336 | | - "Programming Language :: Python :: 3.8", |
337 | | - "Programming Language :: Python :: Implementation :: CPython", |
338 | | - ] |
339 | | - assert classifiers.get({ |
340 | | - "classifiers": ["Environment :: Console"], |
341 | | - "license": "MIT", |
342 | | - }) == [ |
343 | | - "Environment :: Console", |
344 | | - "License :: OSI Approved :: MIT License", |
345 | | - *default_classifiers, |
346 | | - ] |
347 | | - assert classifiers.get({"classifiers": []}) == default_classifiers |
348 | | - assert classifiers.get({"username": "domdfcoding"}) == default_classifiers |
349 | | - assert classifiers.get() == default_classifiers |
350 | | - assert classifiers.get({}) == default_classifiers |
351 | | - |
352 | 358 |
|
353 | 359 | @pytest.mark.parametrize( |
354 | 360 | "wrong_value", |
|
0 commit comments