Skip to content

Commit 919a6e4

Browse files
authored
fix(tests) - clean up docker random hook failures (#922)
1 parent 68f62d5 commit 919a6e4

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tests/contract/test_hook_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def test_call_docker():
714714
'{"hookStatus": "SUCCESS"}__CFN_HOOK_END_RESPONSE__'
715715
)
716716
mock_client.containers.run.return_value = str.encode(response_str)
717-
with patch_creds:
717+
with patch_creds, patch_config:
718718
status, response = hook_client.call(
719719
"CREATE_PRE_PROVISION", HOOK_TARGET_TYPE_NAME, {"foo": "bar"}
720720
)

tests/contract/test_type_configuration.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ def setup_function():
2121
TypeConfiguration.TYPE_CONFIGURATION = None
2222

2323

24+
def teardown_function():
25+
# Rest after to clean TypeConfiguration before the next test
26+
TypeConfiguration.TYPE_CONFIGURATION = None
27+
28+
2429
def test_get_type_configuration_with_not_exist_file():
2530
with patch("builtins.open", mock_open()) as f:
2631
f.side_effect = FileNotFoundError()
27-
try:
28-
TypeConfiguration.get_type_configuration()
29-
except FileNotFoundError:
30-
pass
32+
assert TypeConfiguration.get_type_configuration() is None
3133

3234

3335
@patch("builtins.open", mock_open(read_data=TYPE_CONFIGURATION_TEST_SETTING))
@@ -73,7 +75,4 @@ def test_get_hook_configuration_with_invalid_json():
7375
def test_get_hook_configuration_with_not_exist_file():
7476
with patch("builtins.open", mock_open()) as f:
7577
f.side_effect = FileNotFoundError()
76-
try:
77-
TypeConfiguration.get_hook_configuration()
78-
except FileNotFoundError:
79-
pass
78+
assert TypeConfiguration.get_hook_configuration() is None

0 commit comments

Comments
 (0)