]> granicus.if.org Git - python/commitdiff
Fix flaky os.urandom test.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 21 Feb 2012 21:02:04 +0000 (22:02 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 21 Feb 2012 21:02:04 +0000 (22:02 +0100)
Lib/test/test_os.py

index 1268fa362232df7604dfd9a83ea7a18b3f2f010b..4898e4ea091cfaba91fbd94ed13b0d9929583f76 100644 (file)
@@ -545,12 +545,13 @@ class URandomTests (unittest.TestCase):
             'import os, sys',
             'data = os.urandom(%s)' % count,
             'sys.stdout.write(data)',
-            'sys.stdout.flush()'))
+            'sys.stdout.flush()',
+            'print >> sys.stderr, (len(data), data)'))
         cmd_line = [sys.executable, '-c', code]
         p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         out, err = p.communicate()
-        out = test_support.strip_python_stderr(out)
+        self.assertEqual(p.wait(), 0, (p.wait(), err))
         self.assertEqual(len(out), count)
         return out