Skip to content

Fix profiler unit tests 2 - #180454

Closed
scotts wants to merge 2 commits into
pytorch:mainfrom
scotts:fix_profiler_unit_tests_2
Closed

scotts wants to merge 2 commits into
pytorch:mainfrom
scotts:fix_profiler_unit_tests_2

Conversation

@scotts

@scotts scotts commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Profiler unit tests were calling os.environ["key"] = "value" to change local behavior. But that changes the testing processes environment, polluting other tests.

This causes strange failures, where running python -m pytest test/profiler/test_memory_profiler.py would succeed, but then tests in that file would fail when all tests were run with python -m pytest test/profiler/. Using unittest.mock.patch ensures these changes are isolated.

Note that this PR is a redo of #180380 because that PR got hosed during a bad rebase.

@pytorch-bot

pytorch-bot Bot commented Apr 15, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/180454

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (9 Unrelated Failures)

As of commit 8fa8859 with merge base 54dd3ed (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Apr 15, 2026
@scotts
scotts marked this pull request as ready for review April 15, 2026 11:25
@scotts

scotts commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 15, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

meta-codesync Bot pushed a commit to pytorch/kineto that referenced this pull request May 14, 2026
Summary:
Landing pytorch/pytorch#180454 fixed all of these. We still have that fuzz test remaining which seems to be a real failure.

Pull Request resolved: #1403

Reviewed By: NicolasHug

Differential Revision: D105195889

Pulled By: scotts

fbshipit-source-id: bf9c54dea15b5d07ad84e81c8136ee9617cae987
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
Profiler unit tests were calling `os.environ["key"] = "value"` to change local behavior. But that changes the testing processes environment, polluting other tests.

This causes strange failures, where running `python -m pytest test/profiler/test_memory_profiler.py` would succeed, but then tests in that file would fail when all tests were run with `python -m pytest test/profiler/`. Using `unittest.mock.patch` ensures these changes are isolated.

Note that this PR is a redo of pytorch#180380 because that PR got hosed during a bad rebase.
Pull Request resolved: pytorch#180454
Approved by: https://github.com/ryanzhang22
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Profiler unit tests were calling `os.environ["key"] = "value"` to change local behavior. But that changes the testing processes environment, polluting other tests.

This causes strange failures, where running `python -m pytest test/profiler/test_memory_profiler.py` would succeed, but then tests in that file would fail when all tests were run with `python -m pytest test/profiler/`. Using `unittest.mock.patch` ensures these changes are isolated.

Note that this PR is a redo of pytorch#180380 because that PR got hosed during a bad rebase.
Pull Request resolved: pytorch#180454
Approved by: https://github.com/ryanzhang22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants