diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index 81c7106ac0c0f4..ffc08747a3c4e8 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -122,6 +122,8 @@ tzdata - Run tests that require timezone data. + flaky - Run tests that are known to be unreliable/unstable. + To enable all resources except one, use '-uall,-'. For example, to run all the tests except for the gui tests, give the option '-uall,-gui'. diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 3eff9e753b6d84..baf831a341777e 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -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: # diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index a45b30599d5309..270d9f3b82380e 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -7,7 +7,7 @@ import warnings from test import support -from test.support import is_wasi, Py_DEBUG +from test.support import is_wasi, Py_DEBUG, requires_resource from test.support.os_helper import (TESTFN, skip_unless_symlink, can_symlink, create_empty_file, change_cwd) @@ -521,7 +521,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") + @requires_resource('flaky') def test_selflink(self): tempdir = TESTFN + "_dir" os.makedirs(tempdir) diff --git a/Misc/NEWS.d/next/Tests/2025-02-23-21-20-52.gh-issue-130474.dEckCL.rst b/Misc/NEWS.d/next/Tests/2025-02-23-21-20-52.gh-issue-130474.dEckCL.rst new file mode 100644 index 00000000000000..4f6261f3fef950 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2025-02-23-21-20-52.gh-issue-130474.dEckCL.rst @@ -0,0 +1,2 @@ +Add the ``flaky`` resource for flagging tests with unreliable outcomes +using the :py:deco:`!test.support.required_resource` decorator.