Include the timeout value in TimeoutExpired.

This was the original intention, but it wasn't threaded all the way through due
to 'endtime'.  Also added a trivial assertion to get coverage of __str__.
This commit is contained in:
Reid Kleckner 2011-03-16 16:57:54 -04:00
parent 252183e4b6
commit 2b228f0d9b
2 changed files with 35 additions and 23 deletions

View file

@ -651,7 +651,9 @@ class ProcessTestCase(BaseTestCase):
def test_wait_timeout(self):
p = subprocess.Popen([sys.executable,
"-c", "import time; time.sleep(0.1)"])
self.assertRaises(subprocess.TimeoutExpired, p.wait, timeout=0.01)
with self.assertRaises(subprocess.TimeoutExpired) as c:
p.wait(timeout=0.01)
self.assertIn("0.01", str(c.exception)) # For coverage of __str__.
self.assertEqual(p.wait(timeout=2), 0)