Skip to content

Commit 7fedd44

Browse files
[release/2.6] Suppress Python UserWarnings to fix compiler logs test (#2577)
PR to fix - dynamo/test_logging.py::LoggingTests::test_logs_out Test compares a console log with the dynamo output log file. It failed due to unrelated python UserWarning messages in the console log: ``` /opt/conda/envs/py_3.10/lib/python3.10/site-packages/redis/connection.py:77: UserWarning: redis-py works best with hiredis. Please consider installing warnings.warn(msg) /opt/conda/envs/py_3.10/lib/python3.10/site-packages/z3/z3core.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources ``` This PR adds the environment variable `PYTHONWARNINGS="ignore"` when starting the test subprocess to suppress UserWarnings in the output Fixes SWDEV-526475
1 parent fba9564 commit 7fedd44

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/dynamo/test_logging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ def test_logs_out(self):
796796
env = dict(os.environ)
797797
env["TORCH_LOGS"] = "dynamo"
798798
env["TORCH_LOGS_OUT"] = file_path
799+
env["PYTHONWARNINGS"] = "ignore"
799800
stdout, stderr = self.run_process_no_exception(
800801
"""\
801802
import torch

0 commit comments

Comments
 (0)