77import weakref
88
99from sys import monitoring
10- from test .support import is_wasi
10+ from test .support import threading_helper
1111from threading import Thread , _PyRLock
1212from unittest import TestCase
1313
@@ -87,7 +87,7 @@ def tearDown(self):
8787 monitoring .free_tool_id (self .tool_id )
8888
8989
90- @unittest . skipIf ( is_wasi , "WASI has no threads." )
90+ @threading_helper . requires_working_threading ( )
9191class SetPreTraceMultiThreaded (InstrumentationMultiThreadedMixin , TestCase ):
9292 """Sets tracing one time after the threads have started"""
9393
@@ -106,7 +106,7 @@ def after_threads(self):
106106 sys .settrace (self .trace_func )
107107
108108
109- @unittest . skipIf ( is_wasi , "WASI has no threads." )
109+ @threading_helper . requires_working_threading ( )
110110class MonitoringMultiThreaded (
111111 MonitoringTestMixin , InstrumentationMultiThreadedMixin , TestCase
112112):
@@ -140,7 +140,7 @@ def during_threads(self):
140140 self .set = not self .set
141141
142142
143- @unittest . skipIf ( is_wasi , "WASI has no threads." )
143+ @threading_helper . requires_working_threading ( )
144144class SetTraceMultiThreaded (InstrumentationMultiThreadedMixin , TestCase ):
145145 """Uses sys.settrace and repeatedly toggles instrumentation on and off"""
146146
@@ -166,7 +166,7 @@ def during_threads(self):
166166 self .set = not self .set
167167
168168
169- @unittest . skipIf ( is_wasi , "WASI has no threads." )
169+ @threading_helper . requires_working_threading ( )
170170class SetProfileMultiThreaded (InstrumentationMultiThreadedMixin , TestCase ):
171171 """Uses sys.setprofile and repeatedly toggles instrumentation on and off"""
172172
@@ -192,7 +192,7 @@ def during_threads(self):
192192 self .set = not self .set
193193
194194
195- @unittest . skipIf ( is_wasi , "WASI has no threads." )
195+ @threading_helper . requires_working_threading ( )
196196class MonitoringMisc (MonitoringTestMixin , TestCase ):
197197 def register_callback (self ):
198198 def callback (* args ):
0 commit comments