]> granicus.if.org Git - python/commitdiff
Let's use assertIsNone / assertIsNotNone. It's hype.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Fri, 5 Mar 2010 01:05:55 +0000 (01:05 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Fri, 5 Mar 2010 01:05:55 +0000 (01:05 +0000)
Lib/test/test_subprocess.py

index ea4f5ab9f2fdcb4640b27d58a5760f920bc422cf..844490944d3239c95359c3dc894b4f356b3ae731 100644 (file)
@@ -655,17 +655,16 @@ class POSIXProcessTestCase(unittest.TestCase):
 
         # Let the process initialize correctly (Issue #3137)
         time.sleep(0.1)
-        self.assertIs(p.poll(), None)
+        self.assertIsNone(p.poll())
         count, maxcount = 0, 3
         # Retry if the process do not receive the SIGINT signal.
         while count < maxcount and p.poll() is None:
             p.send_signal(signal.SIGINT)
             time.sleep(0.1)
             count += 1
-        if p.poll() is None:
-            raise test_support.TestFailed("the subprocess did not receive "
-                                          "the signal SIGINT")
-        elif count > 1:
+        self.assertIsNotNone(p.poll(), "the subprocess did not receive "
+                                       "the signal SIGINT")
+        if count > 1:
             print >>sys.stderr, ("p.send_signal(SIGINT) succeeded "
                                  "after {} attempts".format(count))
         self.assertNotEqual(p.wait(), 0)
@@ -824,6 +823,7 @@ def test_main():
                   ProcessTestCaseNoPoll,
                   HelperFunctionTests)
 
+    unit_tests = (                  POSIXProcessTestCase,)
     test_support.run_unittest(*unit_tests)
     test_support.reap_children()