|
19 | 19 | importpytest |
20 | 20 |
|
21 | 21 | fromtwineimportexceptions |
| 22 | +fromtwineimportrepository |
22 | 23 | fromtwineimportsettings |
23 | 24 |
|
24 | 25 |
|
@@ -76,11 +77,44 @@ def test_settings_transforms_repository_config_non_pypi(write_config_file): |
76 | 77 | asserts.identityisNone |
77 | 78 | asserts.username=="someusername" |
78 | 79 | asserts.password=="password" |
79 | | -asserts.cacertisNone |
80 | 80 | asserts.client_certisNone |
81 | 81 | asserts.disable_progress_barisFalse |
82 | 82 |
|
83 | 83 |
|
| 84 | +deftest_settings_verify_feature_compatibility()->None: |
| 85 | +s=settings.Settings(skip_existing=True) |
| 86 | +s.repository_config= {"repository":repository.WAREHOUSE} |
| 87 | +try: |
| 88 | +s.verify_feature_capability() |
| 89 | +exceptexceptions.UnsupportedConfigurationasunexpected_exc: |
| 90 | +pytest.fail( |
| 91 | +"Expected feature capability to work with production PyPI" |
| 92 | +f" but got{unexpected_exc!r}" |
| 93 | + ) |
| 94 | + |
| 95 | +s.repository_config["repository"]=repository.TEST_WAREHOUSE |
| 96 | +try: |
| 97 | +s.verify_feature_capability() |
| 98 | +exceptexceptions.UnsupportedConfigurationasunexpected_exc: |
| 99 | +pytest.fail( |
| 100 | +"Expected feature capability to work with TestPyPI but got" |
| 101 | +f"{unexpected_exc!r}" |
| 102 | + ) |
| 103 | + |
| 104 | +s.repository_config["repository"]="https://not-really-pypi.example.com/legacy" |
| 105 | +withpytest.raises(exceptions.UnsupportedConfiguration): |
| 106 | +s.verify_feature_capability() |
| 107 | + |
| 108 | +s.skip_existing=False |
| 109 | +try: |
| 110 | +s.verify_feature_capability() |
| 111 | +exceptexceptions.UnsupportedConfigurationasunexpected_exc: |
| 112 | +pytest.fail( |
| 113 | +"Expected an exception only when --skip-existing is provided" |
| 114 | +f" but got{unexpected_exc!r}" |
| 115 | + ) |
| 116 | + |
| 117 | + |
84 | 118 | @pytest.mark.parametrize( |
85 | 119 | "verbose, log_level", [(True,logging.INFO), (False,logging.WARNING)] |
86 | 120 | ) |
|