Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebee49a

Browse files
author
Stefan Krah
committed
Issue #14110: Fix test failures on FreeBSD if the user is in the wheel group.
1 parent 13fe6d1 commit ebee49a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_os.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
else:
5050
USING_LINUXTHREADS = False
5151

52+
# Issue #14110: Some tests fail on FreeBSD if the user is in the wheel group.
53+
HAVE_WHEEL_GROUP = sys.platform.startswith('freebsd') and os.getgid() == 0
54+
5255
# Tests creating TESTFN
5356
class FileTests(unittest.TestCase):
5457
def setUp(self):
@@ -1240,7 +1243,7 @@ def test_setuid(self):
12401243

12411244
if hasattr(os, 'setgid'):
12421245
def test_setgid(self):
1243-
if os.getuid() != 0:
1246+
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
12441247
self.assertRaises(os.error, os.setgid, 0)
12451248
self.assertRaises(OverflowError, os.setgid, 1<<32)
12461249

@@ -1252,7 +1255,7 @@ def test_seteuid(self):
12521255

12531256
if hasattr(os, 'setegid'):
12541257
def test_setegid(self):
1255-
if os.getuid() != 0:
1258+
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
12561259
self.assertRaises(os.error, os.setegid, 0)
12571260
self.assertRaises(OverflowError, os.setegid, 1<<32)
12581261

@@ -1272,7 +1275,7 @@ def test_setreuid_neg1(self):
12721275

12731276
if hasattr(os, 'setregid'):
12741277
def test_setregid(self):
1275-
if os.getuid() != 0:
1278+
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
12761279
self.assertRaises(os.error, os.setregid, 0, 0)
12771280
self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
12781281
self.assertRaises(OverflowError, os.setregid, 0, 1<<32)

0 commit comments

Comments
 (0)