Fix Python 3.14 test timeout: replace utcnow() and remove tee pipe#934
Merged
Conversation
- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc) to eliminate DeprecationWarning on Python 3.14+ - Replace '2>&1 | tee' with pytest --log-file to avoid pipe deadlock that caused the test step to stall until the 5-min timeout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses intermittent CI timeouts on Python 3.14 by removing a deprecated datetime.utcnow() usage that emits warnings, and by eliminating a shell tee pipeline that can hang at the end of the unit test run.
Changes:
- Replace
datetime.utcnow()with timezone-awaredatetime.now(timezone.utc)in WS-Trust request timestamp generation. - Update the unit-test Azure Pipelines step to use pytest’s
--log-fileinstead of2>&1 | tee, removing the pipe.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
msal/wstrust_request.py |
Avoids deprecated utcnow() by generating UTC timestamps via datetime.now(timezone.utc). |
.Pipelines/template-pipeline-stages.yml |
Removes tee piping from the unit-test pytest invocation and writes logs via --log-file instead. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Robbie-Microsoft
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Python 3.14 unit tests intermittently stall at 99% completion, hitting the 5-minute step timeout. The last output before the hang is:
\
##[warning]datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version.
\\
Root Cause
Two issues contribute:
Fix
Testing