]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-92886: Fixing tests that fail when running with optimizations (`-O`) in `test_sys_...
authorJack Hindmarch <1750152+jackh-ncl@users.noreply.github.com>
Tue, 18 Oct 2022 15:59:05 +0000 (16:59 +0100)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2022 15:59:05 +0000 (16:59 +0100)
Lib/test/test_sys_settrace.py
Misc/NEWS.d/next/Tests/2022-05-25-22-43-11.gh-issue-92886.9HQb9e.rst [new file with mode: 0644]

index aa61f8b185883b68b22ac6e0780afed9ff9ca58a..4f577c2ea5da98e3ff3f4430e687fe6ece7a7e74 100644 (file)
@@ -834,9 +834,8 @@ class TraceTestCase(unittest.TestCase):
              (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 @@ class TraceTestCase(unittest.TestCase):
              (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 (file)
index 0000000..0c58704
--- /dev/null
@@ -0,0 +1 @@
+Fixing tests that fail when running with optimizations (``-O``) in ``test_sys_settrace.py``.