Skip to content

Commit ed4e92a

Browse files
committed
remove the new decorators to better names
1 parent 2d6b2d5 commit ed4e92a

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Lib/test/support/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"BrokenIter",
7272
"in_systemd_nspawn_sync_suppressed",
7373
"run_no_yield_async_fn", "run_yielding_async_fn", "async_yield",
74-
"reset_code", "on_github_actions", "requires_root", "requires_non_root",
74+
"reset_code", "on_github_actions",
75+
"requires_root_user", "requires_non_root_user",
7576
]
7677

7778

@@ -3320,5 +3321,5 @@ def control_characters_c0() -> list[str]:
33203321

33213322

33223323
_ROOT_IN_POSIX = hasattr(os, 'geteuid') and os.geteuid() == 0
3323-
requires_root = unittest.skipUnless(_ROOT_IN_POSIX, "test needs root privilege")
3324-
requires_non_root = unittest.skipIf(_ROOT_IN_POSIX, "test needs non-root account")
3324+
requires_root_user = unittest.skipUnless(_ROOT_IN_POSIX, "test needs root privilege")
3325+
requires_non_root_user = unittest.skipIf(_ROOT_IN_POSIX, "test needs non-root account")

Lib/test/test_mailbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from test.support import import_helper, warnings_helper
1212
from test.support import os_helper
1313
from test.support import refleak_helper
14-
from test.support import requires_root
14+
from test.support import requires_root_user
1515
from test.support import socket_helper
1616
import unittest
1717
import textwrap
@@ -1087,7 +1087,7 @@ def test_permissions_after_flush(self):
10871087

10881088
self.assertEqual(os.stat(self._path).st_mode, mode)
10891089

1090-
@requires_root
1090+
@requires_root_user
10911091
@unittest.skipUnless(hasattr(os, 'chown'), 'requires os.chown')
10921092
def test_ownership_after_flush(self):
10931093
# See issue gh-117467

Lib/test/test_os/test_os.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
from test.support import os_helper
3434
from test.support import socket_helper
3535
from test.support import infinite_recursion
36-
from test.support import requires_root
37-
from test.support import requires_non_root
36+
from test.support import requires_root_user
37+
from test.support import requires_non_root_user
3838
from test.support import warnings_helper
3939
from platform import win32_is_iot
4040
from .utils import create_file
@@ -2255,7 +2255,7 @@ def test_chown_gid(self):
22552255
gid = os.stat(os_helper.TESTFN).st_gid
22562256
self.assertEqual(gid, gid_2)
22572257

2258-
@requires_root
2258+
@requires_root_user
22592259
@unittest.skipUnless(len(all_users) > 1, "test needs more than one user")
22602260
def test_chown_with_root(self):
22612261
uid_1, uid_2 = all_users[:2]
@@ -2267,7 +2267,7 @@ def test_chown_with_root(self):
22672267
uid = os.stat(os_helper.TESTFN).st_uid
22682268
self.assertEqual(uid, uid_2)
22692269

2270-
@requires_non_root
2270+
@requires_non_root_user
22712271
@unittest.skipUnless(len(all_users) > 1, "test needs and more than one user")
22722272
def test_chown_without_permission(self):
22732273
uid_1, uid_2 = all_users[:2]

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from test.support import is_emscripten, is_wasi, is_wasm32
2121
from test.support import infinite_recursion
2222
from test.support import os_helper
23-
from test.support import requires_root
23+
from test.support import requires_root_user
2424
from test.support.os_helper import TESTFN, FS_NONASCII, FakePath
2525
try:
2626
import fcntl
@@ -1550,7 +1550,7 @@ def raiser(*args, **kwargs):
15501550
self.assertRaises(FileNotFoundError, source.copy, target)
15511551

15521552
@unittest.skipIf(sys.platform == "win32" or sys.platform == "wasi", "directories are always readable on Windows and WASI")
1553-
@requires_root
1553+
@requires_root_user
15541554
def test_copy_dir_no_read_permission(self):
15551555
base = self.cls(self.base)
15561556
source = base / 'dirE'
@@ -2023,7 +2023,7 @@ def test_owner(self):
20232023
self.assertEqual(expected_name, p.owner())
20242024

20252025
@unittest.skipUnless(pwd, "the pwd module is needed for this test")
2026-
@requires_root
2026+
@requires_root_user
20272027
def test_owner_no_follow_symlinks(self):
20282028
all_users = [u.pw_uid for u in pwd.getpwall()]
20292029
if len(all_users) < 2:
@@ -2058,7 +2058,7 @@ def test_group(self):
20582058
self.assertEqual(expected_name, p.group())
20592059

20602060
@unittest.skipUnless(grp, "the grp module is needed for this test")
2061-
@requires_root
2061+
@requires_root_user
20622062
def test_group_no_follow_symlinks(self):
20632063
all_groups = [g.gr_gid for g in grp.getgrall()]
20642064
if len(all_groups) < 2:

0 commit comments

Comments
 (0)