Skip to content

Commit 416d96b

Browse files
committed
MOAR WINDOWS
1 parent f463436 commit 416d96b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

Lib/test/test_external_inspection.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ def foo():
123123
(ANY, threading.__file__, ANY),
124124
("<module>", script_name, 19),
125125
]
126-
self.assertEqual(stack_trace, [
127-
(ANY, thread_expected_stack_trace),
128-
(ANY, main_thread_stack_trace),
129-
])
126+
# Is possible that there are more threads, so we check that the
127+
# expected stack traces are in the result (looking at you Windows!)
128+
self.assertIn((ANY, thread_expected_stack_trace), stack_trace)
129+
self.assertIn((ANY, main_thread_stack_trace), stack_trace)
130130

131131
@skip_if_not_supported
132132
@unittest.skipIf(
@@ -726,9 +726,16 @@ async def main():
726726
)
727727
def test_self_trace(self):
728728
stack_trace = get_stack_trace(os.getpid())
729-
self.assertEqual(stack_trace[0][0], threading.get_native_id())
729+
# Is possible that there are more threads, so we check that the
730+
# expected stack traces are in the result (looking at you Windows!)
731+
this_tread_stack = None
732+
for thread_id, stack in stack_trace:
733+
if thread_id == threading.get_native_id():
734+
this_tread_stack = stack
735+
break
736+
self.assertIsNotNone(this_tread_stack)
730737
self.assertEqual(
731-
stack_trace[0][1][:2],
738+
stack[:2],
732739
[
733740
(
734741
"get_stack_trace",

0 commit comments

Comments
 (0)