diff options
author | Victor Stinner <vstinner@python.org> | 2024-09-24 14:33:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 14:33:27 (GMT) |
commit | 38a5beb12a64461a06b84fab285944ecb66de04c (patch) | |
tree | a2a4a3e05c3646db256c02a7a3e880702028e808 /Lib | |
parent | d21b0b5d36834d4d35aec3a01661597019594936 (diff) | |
download | cpython-38a5beb12a64461a06b84fab285944ecb66de04c.zip cpython-38a5beb12a64461a06b84fab285944ecb66de04c.tar.gz cpython-38a5beb12a64461a06b84fab285944ecb66de04c.tar.bz2 |
gh-124402: Require cpu resource in test_free_threading (#124438)
Require the 'cpu' test resource on slow test_free_threading tests.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_free_threading/test_list.py | 3 | ||||
-rw-r--r-- | Lib/test/test_free_threading/test_monitoring.py | 3 | ||||
-rw-r--r-- | Lib/test/test_free_threading/test_type.py | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_free_threading/test_list.py b/Lib/test/test_free_threading/test_list.py index 6ad806d..c6b58fc 100644 --- a/Lib/test/test_free_threading/test_list.py +++ b/Lib/test/test_free_threading/test_list.py @@ -3,6 +3,7 @@ import unittest from threading import Thread from unittest import TestCase +from test import support from test.support import threading_helper @@ -13,6 +14,7 @@ class C: @threading_helper.requires_working_threading() class TestList(TestCase): + @support.requires_resource('cpu') def test_racing_iter_append(self): l = [] @@ -42,6 +44,7 @@ class TestList(TestCase): for reader in readers: reader.join() + @support.requires_resource('cpu') def test_racing_iter_extend(self): iters = [ lambda x: [x], diff --git a/Lib/test/test_free_threading/test_monitoring.py b/Lib/test/test_free_threading/test_monitoring.py index 78303f4..be58245 100644 --- a/Lib/test/test_free_threading/test_monitoring.py +++ b/Lib/test/test_free_threading/test_monitoring.py @@ -7,6 +7,7 @@ import unittest import weakref from sys import monitoring +from test import support from test.support import threading_helper from threading import Thread, _PyRLock from unittest import TestCase @@ -43,6 +44,7 @@ class InstrumentationMultiThreadedMixin: """Runs once after the test is done""" pass + @support.requires_resource('cpu') def test_instrumentation(self): # Setup a bunch of functions which will need instrumentation... funcs = [] @@ -218,6 +220,7 @@ class MonitoringMisc(MonitoringTestMixin, TestCase): for ref in self.refs: self.assertEqual(ref(), None) + @support.requires_resource('cpu') def test_set_local_trace_opcodes(self): def trace(frame, event, arg): frame.f_trace_opcodes = True diff --git a/Lib/test/test_free_threading/test_type.py b/Lib/test/test_free_threading/test_type.py index 649676d..977bfd2 100644 --- a/Lib/test/test_free_threading/test_type.py +++ b/Lib/test/test_free_threading/test_type.py @@ -5,6 +5,7 @@ from concurrent.futures import ThreadPoolExecutor from threading import Thread from unittest import TestCase +from test import support from test.support import threading_helper @@ -96,6 +97,7 @@ class TestType(TestCase): self.run_one(writer_func, reader_func) + @support.requires_resource('cpu') def test___class___modification(self): class Foo: pass |