Skip to content

Add context manager API to azure.identity credentials#19746

Merged
chlowell merged 15 commits intoAzure:mainfrom
chlowell:context-managers
Aug 16, 2021
Merged

Add context manager API to azure.identity credentials#19746
chlowell merged 15 commits intoAzure:mainfrom
chlowell:context-managers

Conversation

@chlowell
Copy link
Member

@chlowell chlowell commented Jul 9, 2021

Closes #18798

@chlowell chlowell requested review from mccoyp and schaabs as code owners July 9, 2021 21:27
@ghost ghost added the Azure.Identity label Jul 9, 2021
@pytest.mark.parametrize("environ", ALL_ENVIRONMENTS)
def test_close(environ):
transport = mock.MagicMock()
with mock.patch.dict("os.environ", environ, clear=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to patch {Credential}.__module__ + ".os.environ" across the board, or just in async EnvironmentCredential tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use more narrow patches everywhere. It doesn't work here because the inner credentials need to observe the same environment variables. Since broad patches don't impact our tests as currently run, I prefer using one here over baking more knowledge of the implementation into this test or testing the inner credentials separately.

Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com>
@chlowell chlowell merged commit f16b965 into Azure:main Aug 16, 2021
@chlowell chlowell deleted the context-managers branch August 16, 2021 15:50
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Aug 23, 2021
…into have_pipelines_support_rest

* 'main' of https://github.com/Azure/azure-sdk-for-python: (108 commits)
  Enable API review approval check for Java spring packages (Azure#20311)
  [AutoRelease] t2-iothubprovisioningservices-2021-07-15-81882 (Azure#19816)
  Increment package version after release of azure-eventgrid (Azure#20204)
  Sync eng/common directory with azure-sdk-tools for PR 1909 (Azure#20298)
  Rename attrs is metrics (Azure#20236)
  [EventHubs] checkpointstoretable - skip tests until env vars configured (Azure#20289)
  Update to use timespan (Azure#20233)
  Prevent wildcard expansion in git sparse checkout add (Azure#20267)
  Fix typo and polish the key concepts (Azure#18407)
  Fix IOT Device Update readme issue (Azure#18752)
  Add context manager API to azure.identity credentials (Azure#19746)
  Add support for 'files' configuration (Azure#20272)
  Update main for 30-close.py (Azure#20287)
  [AutoRelease] t2-purview-2021-08-13-30358 (Azure#20260)
  add implementation for checkpointstoretable (Azure#19905)
  Fix resource clean-up script (Azure#20273)
  [Tables] Fix bug in update mode (Azure#20264)
  Add Rest Method checks to Prepare-Release (Azure#20275)
  Update release date (Azure#20270)
  Update the release date for ACS chat 1.1.0b1 (Azure#20277)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable opening and closing synchronous credential transports

2 participants