Skip to content

gh-130474: Create and implement flaky resource #130489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
from test.support import requires_resource


# Skip tests if _multiprocessing wasn't built.
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network',
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'walltime')
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'walltime', 'flaky')

# Other resources excluded from --use=all:
#
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from test import support
from test.support import is_wasi, Py_DEBUG
from test.support import requires_resource
from test.support.os_helper import (TESTFN, skip_unless_symlink,
can_symlink, create_empty_file, change_cwd)

Expand Down Expand Up @@ -521,7 +522,7 @@ class SymlinkLoopGlobTests(unittest.TestCase):
# gh-109959: On Linux, glob._isdir() and glob._lexists() can return False
# randomly when checking the "link/" symbolic link.
# https://github.com/python/cpython/issues/109959#issuecomment-2577550700
@unittest.skip("flaky test")
@support.requires_resource('flaky')
def test_selflink(self):
tempdir = TESTFN + "_dir"
os.makedirs(tempdir)
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import time
import unittest
from test import support
from test.support import requires_resource
from test.support import (
is_apple, is_apple_mobile, os_helper, threading_helper
)
Expand Down Expand Up @@ -1353,6 +1354,7 @@ def handler(signum, frame):
@unittest.skipUnless(hasattr(signal, "SIGUSR1"),
"test needs SIGUSR1")
@threading_helper.requires_working_threading()
@support.requires_resource('flaky')
def test_stress_modifying_handlers(self):
# bpo-43406: race condition between trip_signal() and signal.signal
signum = signal.SIGUSR1
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_smtplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from test.support import threading_helper
from test.support import asyncore
from test.support import smtpd
from test.support import requires_resource
from unittest.mock import Mock


Expand Down Expand Up @@ -374,6 +375,7 @@ def testHELP(self):
b'RCPT DATA RSET NOOP QUIT VRFY')
smtp.quit()

@support.requires_resource('flaky')
def testSend(self):
# connect and send mail
m = 'A test message'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created flaky resource for flagging tests with flaky outcomes using the support.required_resource() decorator. Flagged some initial tests based on-inline comments. This resource can be used to automate re-running certain tests in CI.
Loading