mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) (#108798)
gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)
Only mark tests which spend significant system or user time,
by itself or in subprocesses.
(cherry picked from commit f3ba0a74cd
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
7269916cd7
commit
dcaacd9066
32 changed files with 57 additions and 5 deletions
|
@ -8,7 +8,7 @@ import unittest
|
|||
import socket
|
||||
import shutil
|
||||
import threading
|
||||
from test.support import requires, bigmemtest
|
||||
from test.support import requires, bigmemtest, requires_resource
|
||||
from test.support import SHORT_TIMEOUT
|
||||
from test.support import socket_helper
|
||||
from test.support.os_helper import TESTFN, unlink
|
||||
|
@ -173,6 +173,7 @@ class TestCopyfile(LargeFileTest, unittest.TestCase):
|
|||
# Exact required disk space would be (size * 2), but let's give it a
|
||||
# bit more tolerance.
|
||||
@skip_no_disk_space(TESTFN, size * 2.5)
|
||||
@requires_resource('cpu')
|
||||
def test_it(self):
|
||||
# Internally shutil.copyfile() can use "fast copy" methods like
|
||||
# os.sendfile().
|
||||
|
@ -222,6 +223,7 @@ class TestSocketSendfile(LargeFileTest, unittest.TestCase):
|
|||
# Exact required disk space would be (size * 2), but let's give it a
|
||||
# bit more tolerance.
|
||||
@skip_no_disk_space(TESTFN, size * 2.5)
|
||||
@requires_resource('cpu')
|
||||
def test_it(self):
|
||||
port = socket_helper.find_unused_port()
|
||||
with socket.create_server(("", port)) as sock:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue