Skip to content

Commit 4ecf727

Browse files
committed
Fix test on 3.9
1 parent 3097691 commit 4ecf727

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

tests/unit/botocore/test_credentials.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,22 +4107,22 @@ def test_add_account_id_to_response_with_invalid_arn(
41074107
assert 'Unable to extract account ID from Arn' in caplog.text
41084108

41094109

4110+
def load_login_test_cases():
4111+
test_dir = os.path.join(
4112+
os.path.dirname(os.path.abspath(__file__)),
4113+
'login',
4114+
'login-provider-test-cases.json',
4115+
)
4116+
with open(test_dir) as f:
4117+
data = json.load(f)
4118+
return data
4119+
4120+
41104121
class TestLoginProvider:
41114122
FROZEN_TIME = datetime(2025, 11, 19, 0, 0, 0, tzinfo=tzutc())
41124123

4113-
@staticmethod
4114-
def load_test_cases():
4115-
test_dir = os.path.join(
4116-
os.path.dirname(os.path.abspath(__file__)),
4117-
'login',
4118-
'login-provider-test-cases.json',
4119-
)
4120-
with open(test_dir) as f:
4121-
data = json.load(f)
4122-
return data
4123-
41244124
@pytest.mark.parametrize(
4125-
"test_case", load_test_cases(), ids=lambda x: x["documentation"]
4125+
"test_case", load_login_test_cases(), ids=lambda x: x["documentation"]
41264126
)
41274127
def test_login_credentials(self, test_case):
41284128
tempdir = tempfile.mkdtemp()
@@ -4305,8 +4305,12 @@ def test_login_provider_feature_ids_in_context(client_context):
43054305
}
43064306
}
43074307

4308-
with mock.patch('botocore.credentials.LoginCredentialsLoader'), \
4309-
mock.patch('botocore.credentials.LoginCredentialFetcher') as mock_fetcher_class:
4308+
with (
4309+
mock.patch('botocore.credentials.LoginCredentialsLoader'),
4310+
mock.patch(
4311+
'botocore.credentials.LoginCredentialFetcher'
4312+
) as mock_fetcher_class,
4313+
):
43104314
mock_fetcher = mock.Mock()
43114315
date_in_future = datetime.utcnow() + timedelta(hours=1)
43124316
expiry_time = date_in_future.isoformat() + 'Z'

0 commit comments

Comments
 (0)