# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License").3# You may not use this file except in compliance with the License.4# You may obtain a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS,10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# See the License for the specific language governing permissions and12# limitations under the License.13from unittest import mock1415import pytest1617from tests import requires_crt181920class TestRequiresCrt:21def test_bare_requires_crt_fails_immediately(self):22with pytest.raises(TypeError):2324@requires_crt25def my_test():26pass2728def test_requires_crt_skips_when_no_crt(self):29with mock.patch('tests.HAS_CRT', False):3031@requires_crt()32def my_test():33assert False3435assert getattr(my_test, '__unittest_skip__', False) is True3637def test_requires_crt_runs_when_crt_available(self):38with mock.patch('tests.HAS_CRT', True):3940@requires_crt()41def my_test():42pass4344assert getattr(my_test, '__unittest_skip__', False) is False454647