Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter warnings more narrowly in test_BOTO_DISABLE_COMMONNAME #2753

Merged
merged 1 commit into from Sep 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/unit/test_client.py
Expand Up @@ -11,10 +11,9 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import os
import warnings
from contextlib import closing

import pytest

import botocore
import botocore.config
from botocore import client, exceptions, hooks
Expand Down Expand Up @@ -1643,11 +1642,18 @@ def test_BOTO_DISABLE_COMMONNAME(self):
creator = self.create_client_creator()
self.endpoint_data['sslCommonName'] = 'bar'

with pytest.warns(None) as warning:
with warnings.catch_warnings(record=True) as captured_warnings:
creator.create_client(
'myservice', 'us-west-2', credentials=self.credentials
)
self.assertEqual(len(warning), 0)

deprecated_endpoint_warnings = [
w
for w in captured_warnings
if w.category == FutureWarning
and 'deprecated endpoint' in str(w.message)
]
self.assertEqual(len(deprecated_endpoint_warnings), 0)


class TestClientErrors(TestAutoGeneratedClient):
Expand Down