summaryrefslogtreecommitdiff
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 5cc04fd46d..eecddfed8c 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -15,7 +15,6 @@ import signal
import time
import os
import platform
-import pwd
import stat
import tempfile
import unittest
@@ -23,6 +22,11 @@ import warnings
import textwrap
from contextlib import contextmanager
+try:
+ import pwd
+except ImportError:
+ pwd = None
+
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
os_helper.TESTFN + '-dummy-symlink')
@@ -126,6 +130,7 @@ class PosixTester(unittest.TestCase):
@unittest.skipUnless(hasattr(posix, 'initgroups'),
"test needs os.initgroups()")
+ @unittest.skipUnless(hasattr(pwd, 'getpwuid'), "test needs pwd.getpwuid()")
def test_initgroups(self):
# It takes a string and an integer; check that it raises a TypeError
# for other argument lists.