]> granicus.if.org Git - python/commitdiff
test_nis would fail if test.test_support.verbose was true but NIS was not set
authorBrett Cannon <bcannon@gmail.com>
Wed, 19 Mar 2008 16:50:13 +0000 (16:50 +0000)
committerBrett Cannon <bcannon@gmail.com>
Wed, 19 Mar 2008 16:50:13 +0000 (16:50 +0000)
up on the machine.

Closes issue2411. Thanks Michael Bishop.

Lib/test/test_nis.py
Misc/NEWS

index 590868f0108d1955f690674e0a79283131978c9a..c958d4b23a5c3fc24a3a8d78ab9d6be959c46d78 100644 (file)
@@ -1,4 +1,4 @@
-from test.test_support import verbose, run_unittest
+from test import test_support
 import unittest
 import nis
 
@@ -8,8 +8,10 @@ class NisTests(unittest.TestCase):
             maps = nis.maps()
         except nis.error, msg:
             # NIS is probably not active, so this test isn't useful
-            if verbose:
-                self.fail("(failing because of verbose mode) %s" % msg)
+            if test_support.verbose:
+                print "Test Skipped:", msg
+            # Can't raise TestSkipped as regrtest only recognizes the exception
+            #   import time.
             return
         try:
             # On some systems, this map is only accessible to the
@@ -35,7 +37,7 @@ class NisTests(unittest.TestCase):
                 break
 
 def test_main():
-    run_unittest(NisTests)
+    test_support.run_unittest(NisTests)
 
 if __name__ == '__main__':
     test_main()
index 5b2292d57050838bdaf3cf5e334f6f634d739784..d787eb063b4e94cf8c74fff1306bf4ac5d92d910 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -99,6 +99,9 @@ Library
 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.
 
 - Rewrite test_errno to use unittest and no longer be a no-op.