Kaydet (Commit) 7919d98d authored tarafından Brett Cannon's avatar Brett Cannon

test_nis would fail if test.test_support.verbose was true but NIS was not set

up on the machine.

Closes issue2411. Thanks Michael Bishop.
üst 12b580b2
from test.test_support import verbose, run_unittest from test import test_support
import unittest import unittest
import nis import nis
...@@ -8,8 +8,10 @@ class NisTests(unittest.TestCase): ...@@ -8,8 +8,10 @@ class NisTests(unittest.TestCase):
maps = nis.maps() maps = nis.maps()
except nis.error, msg: except nis.error, msg:
# NIS is probably not active, so this test isn't useful # NIS is probably not active, so this test isn't useful
if verbose: if test_support.verbose:
self.fail("(failing because of verbose mode) %s" % msg) print "Test Skipped:", msg
# Can't raise TestSkipped as regrtest only recognizes the exception
# import time.
return return
try: try:
# On some systems, this map is only accessible to the # On some systems, this map is only accessible to the
...@@ -35,7 +37,7 @@ class NisTests(unittest.TestCase): ...@@ -35,7 +37,7 @@ class NisTests(unittest.TestCase):
break break
def test_main(): def test_main():
run_unittest(NisTests) test_support.run_unittest(NisTests)
if __name__ == '__main__': if __name__ == '__main__':
test_main() test_main()
...@@ -99,6 +99,9 @@ Library ...@@ -99,6 +99,9 @@ Library
Tests Tests
----- -----
- test_nis no longer fails when test.test_support.verbose is true and NIS is
not set up on the testing machine.
- Output comparison tests are no longer supported. - Output comparison tests are no longer supported.
- Rewrite test_errno to use unittest and no longer be a no-op. - Rewrite test_errno to use unittest and no longer be a no-op.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment