Skip to content

Commit b89c8e4

Browse files
committed
Revert clidriver change and use start_as_current_context in tests instead
1 parent 156b6f9 commit b89c8e4

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

awscli/clidriver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109

110110

111111
def main():
112-
return AWSCLIEntryPoint().main(sys.argv[1:])
112+
with start_as_current_context():
113+
return AWSCLIEntryPoint().main(sys.argv[1:])
113114

114115

115116
def create_clidriver(args=None, event_hooks=None):
@@ -238,8 +239,7 @@ def __init__(self, driver=None):
238239

239240
def main(self, args):
240241
try:
241-
with start_as_current_context():
242-
rc = self._do_main(args)
242+
rc = self._do_main(args)
243243
except BaseException as e:
244244
LOG.debug("Exception caught in AWSCLIEntryPoint", exc_info=True)
245245
return self._error_handler.handle_exception(

tests/functional/sso/test_login.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import os
1616
import re
1717

18+
from botocore.context import start_as_current_context
19+
1820
from awscli.testutils import mock
1921
from tests.functional.sso import BaseSSOTest
2022

@@ -562,7 +564,8 @@ def test_config_not_rewritten_when_region_matches(self):
562564

563565
def test_vanity_url_sets_feature_id_in_user_agent(self):
564566
self.add_oidc_auth_code_responses(self.access_token)
565-
self.run_cmd('sso login')
567+
with start_as_current_context():
568+
self.run_cmd('sso login')
566569
self.assertIn('AM', self.last_request_dict['headers']['User-Agent'])
567570

568571

@@ -636,6 +639,7 @@ def test_login_uses_configured_region(self):
636639

637640
def test_direct_url_does_not_set_vanity_feature_id(self):
638641
self.add_oidc_auth_code_responses(self.access_token)
639-
self.run_cmd('sso login')
642+
with start_as_current_context():
643+
self.run_cmd('sso login')
640644
user_agent = self.last_request_dict['headers']['User-Agent']
641645
self.assertNotIn('AM', user_agent.split('m/')[-1])

0 commit comments

Comments
 (0)