aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_nis.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_nis.py')
-rw-r--r--Lib/test/test_nis.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py
index 8d495505d13..830c24d7813 100644
--- a/Lib/test/test_nis.py
+++ b/Lib/test/test_nis.py
@@ -1,16 +1,19 @@
-from test import test_support
+from test import support
import unittest
+import sys
+
+# Skip test if nis module does not exist.
+nis = support.import_module('nis')
-nis = test_support.import_module('nis')
class NisTests(unittest.TestCase):
def test_maps(self):
try:
maps = nis.maps()
- except nis.error, msg:
+ except nis.error as msg:
# NIS is probably not active, so this test isn't useful
- if test_support.verbose:
- print "Test Skipped:", msg
+ if support.verbose:
+ print("Test Skipped:", msg)
# Can't raise SkipTest as regrtest only recognizes the exception
# import time.
return
@@ -38,7 +41,7 @@ class NisTests(unittest.TestCase):
break
def test_main():
- test_support.run_unittest(NisTests)
+ support.run_unittest(NisTests)
if __name__ == '__main__':
test_main()