Fix Mock 4.0.3 compatibility - Unpatch only once during teardown (#3541)

* #3535 - Unpatch only once during teardown

* EnvVar patching - Fix Python2 bug

* Allow latest version of mock-library
This commit is contained in:
Bert Blommers 2021-02-15 08:42:16 +00:00 committed by GitHub
commit d7b8419791
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 8 deletions

View file

@ -0,0 +1,18 @@
import unittest
import boto3
from moto import mock_s3
@mock_s3
class ClassDecoratorTest(unittest.TestCase):
"""
https://github.com/spulec/moto/issues/3535
An update to the mock-package introduced a failure during teardown.
This test is in place to catch any similar failures with our mocking approach
"""
def test_instantiation_succeeds(self):
s3 = boto3.client("s3", region_name="us-east-1")
assert s3 is not None