Skip to content

Commit 5615351

Browse files
authored
[3.13] pythongh-124402: Require cpu resource in test_free_threading (python#124438) (python#124439)
pythongh-124402: Require cpu resource in test_free_threading (python#124438) Require the 'cpu' test resource on slow test_free_threading tests. (cherry picked from commit 38a5beb)
1 parent a573b23 commit 5615351

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Lib/test/test_free_threading/test_list.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from threading import Thread
44
from unittest import TestCase
55

6+
from test import support
67
from test.support import threading_helper
78

89

@@ -13,6 +14,7 @@ def __init__(self, v):
1314

1415
@threading_helper.requires_working_threading()
1516
class TestList(TestCase):
17+
@support.requires_resource('cpu')
1618
def test_racing_iter_append(self):
1719

1820
l = []
@@ -42,6 +44,7 @@ def reader_func():
4244
for reader in readers:
4345
reader.join()
4446

47+
@support.requires_resource('cpu')
4548
def test_racing_iter_extend(self):
4649
iters = [
4750
lambda x: [x],

Lib/test/test_free_threading/test_monitoring.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import weakref
88

99
from sys import monitoring
10+
from test import support
1011
from test.support import threading_helper
1112
from threading import Thread, _PyRLock
1213
from unittest import TestCase
@@ -43,6 +44,7 @@ def after_test(self):
4344
"""Runs once after the test is done"""
4445
pass
4546

47+
@support.requires_resource('cpu')
4648
def test_instrumentation(self):
4749
# Setup a bunch of functions which will need instrumentation...
4850
funcs = []
@@ -218,6 +220,7 @@ def test_register_callback(self):
218220
for ref in self.refs:
219221
self.assertEqual(ref(), None)
220222

223+
@support.requires_resource('cpu')
221224
def test_set_local_trace_opcodes(self):
222225
def trace(frame, event, arg):
223226
frame.f_trace_opcodes = True

Lib/test/test_free_threading/test_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from threading import Thread
66
from unittest import TestCase
77

8+
from test import support
89
from test.support import threading_helper, import_helper
910

1011

@@ -96,6 +97,7 @@ def reader_func():
9697

9798
self.run_one(writer_func, reader_func)
9899

100+
@support.requires_resource('cpu')
99101
def test___class___modification(self):
100102
class Foo:
101103
pass

0 commit comments

Comments
 (0)