[Python-checkins] gh-92886: Fixing tests that fail when running with optimizations (`-O`) in `test_sys_settrace.py` (GH-93234)

iritkatriel webhook-mailer at python.org
Tue Oct 18 11:59:11 EDT 2022


https://github.com/python/cpython/commit/debacd9ad51eaeedac5517404de5ead3f2258c22
commit: debacd9ad51eaeedac5517404de5ead3f2258c22
branch: main
author: Jack Hindmarch <1750152+jackh-ncl at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-10-18T16:59:05+01:00
summary:

gh-92886: Fixing tests that fail when running with optimizations (`-O`) in `test_sys_settrace.py` (GH-93234)

files:
A Misc/NEWS.d/next/Tests/2022-05-25-22-43-11.gh-issue-92886.9HQb9e.rst
M Lib/test/test_sys_settrace.py

diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index aa61f8b18588..4f577c2ea5da 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -834,9 +834,8 @@ def func():
              (5, 'line'),
              (6, 'line'),
              (7, 'line'),
-             (10, 'line'),
-             (13, 'line'),
-             (13, 'return')])
+             (10, 'line')] +
+             ([(13, 'line'), (13, 'return')] if __debug__ else [(10, 'return')]))
 
     def test_continue_through_finally(self):
 
@@ -871,9 +870,8 @@ def func():
              (6, 'line'),
              (7, 'line'),
              (10, 'line'),
-             (3, 'line'),
-             (13, 'line'),
-             (13, 'return')])
+             (3, 'line')] +
+             ([(13, 'line'), (13, 'return')] if __debug__ else [(3, 'return')]))
 
     def test_return_through_finally(self):
 
diff --git a/Misc/NEWS.d/next/Tests/2022-05-25-22-43-11.gh-issue-92886.9HQb9e.rst b/Misc/NEWS.d/next/Tests/2022-05-25-22-43-11.gh-issue-92886.9HQb9e.rst
new file mode 100644
index 000000000000..0c5870441c3b
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-05-25-22-43-11.gh-issue-92886.9HQb9e.rst
@@ -0,0 +1 @@
+Fixing tests that fail when running with optimizations (``-O``) in ``test_sys_settrace.py``.



More information about the Python-checkins mailing list