]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-124402: Require cpu resource in test_free_threading (#124438) (#124439)
authorVictor Stinner <vstinner@python.org>
Tue, 24 Sep 2024 18:26:02 +0000 (20:26 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 18:26:02 +0000 (11:26 -0700)
gh-124402: Require cpu resource in test_free_threading (#124438)

Require the 'cpu' test resource on slow test_free_threading tests.

(cherry picked from commit 38a5beb12a64461a06b84fab285944ecb66de04c)

Lib/test/test_free_threading/test_list.py
Lib/test/test_free_threading/test_monitoring.py
Lib/test/test_free_threading/test_type.py

index 6ad806d67a80eddd2ec6b648a5655b28c10bc6d5..c6b58fcd86f449cfbcc2d6bf34dc6c26867e578e 100644 (file)
@@ -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],
index 3a3f1ba3b605d675b04f712dd1c2a7b233585232..14a14fdebf1f19b3eeeba5f2168d26f79f6fafae 100644 (file)
@@ -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
index 29ca929994cb79725bc16f2abfd6edec74c1c95d..45b913afd38fc9fe11d6da9fa16af37a12274101 100644 (file)
@@ -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, import_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