This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_subprocess fails under Windows
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rnk Nosy List: pitrou, rnk, santoso.wijaya
Priority: normal Keywords: patch

Created on 2011-03-20 12:05 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
timeoutsec.patch santoso.wijaya, 2011-03-20 21:03 review
Messages (5)
msg131486 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-03-20 12:05
There seem to be some buglets in the timeout code:

http://www.python.org/dev/buildbot/all/builders/x86%20Windows7%203.x/builds/2783/steps/test/logs/stdio

======================================================================
ERROR: test_check_output_timeout (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 135, in test_check_output_timeout
    timeout=3)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 533, in check_output
    output, unused_err = process.communicate(timeout=timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_communicate_timeout (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 433, in test_communicate_timeout
    timeout=0.3)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises
    callableObj(*args, **kwargs)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_communicate_timeout_large_ouput (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 452, in test_communicate_timeout_large_ouput
    self.assertRaises(subprocess.TimeoutExpired, p.communicate, timeout=0.4)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises
    callableObj(*args, **kwargs)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_check_output_timeout (test.test_subprocess.ContextManagerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 135, in test_check_output_timeout
    timeout=3)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 533, in check_output
    output, unused_err = process.communicate(timeout=timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_communicate_timeout (test.test_subprocess.ContextManagerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 433, in test_communicate_timeout
    timeout=0.3)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises
    callableObj(*args, **kwargs)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_communicate_timeout_large_ouput (test.test_subprocess.ContextManagerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 452, in test_communicate_timeout_large_ouput
    self.assertRaises(subprocess.TimeoutExpired, p.communicate, timeout=0.4)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises
    callableObj(*args, **kwargs)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate
    raise TimeoutExpired(self.args)
TypeError: __init__() takes at least 3 arguments (2 given)

======================================================================
FAIL: test_wait_timeout (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 657, in test_wait_timeout
    self.assertIn("0.01", str(c.exception))  # For coverage of __str__.
AssertionError: '0.01' not found in "Command '['D:\\\\cygwin\\\\home\\\\db3l\\\\buildarea\\\\3.x.bolen-windows7\\\\build\\\\PCbuild\\\\python_d.exe', '-c', 'import time; time.sleep(0.1)']' timed out after 10 seconds"

======================================================================
FAIL: test_wait_timeout (test.test_subprocess.ContextManagerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 657, in test_wait_timeout
    self.assertIn("0.01", str(c.exception))  # For coverage of __str__.
AssertionError: '0.01' not found in "Command '['D:\\\\cygwin\\\\home\\\\db3l\\\\buildarea\\\\3.x.bolen-windows7\\\\build\\\\PCbuild\\\\python_d.exe', '-c', 'import time; time.sleep(0.1)']' timed out after 10 seconds"

----------------------------------------------------------------------
Ran 307 tests in 370.283s
msg131539 - (view) Author: Santoso Wijaya (santoso.wijaya) * Date: 2011-03-20 20:46
The timeout value given to wait() is multiplied by 1000 before being passed to TimeoutExpired constructor. The multiplication is unnecessary since we take the input unit as time unit second.
msg131542 - (view) Author: Santoso Wijaya (santoso.wijaya) * Date: 2011-03-20 21:03
Actually, the multiplication was necessary because _subprocess.WaitForSingleObject takes the timeout argument in millisecond unit. Defer multiplication until then.
msg131543 - (view) Author: Reid Kleckner (rnk) (Python committer) Date: 2011-03-20 21:07
It is necessary, WaitForSingleObject takes its argument in
milliseconds.  It will make the exception message wrong, though, which
I can fix.

Reid

On Sun, Mar 20, 2011 at 1:46 PM, Santoso Wijaya <report@bugs.python.org> wrote:
>
> Santoso Wijaya <santoso.wijaya@gmail.com> added the comment:
>
> The timeout value given to wait() is multiplied by 1000 before being passed to TimeoutExpired constructor. The multiplication is unnecessary since we take the input unit as time unit second.
>
> ----------
> keywords: +patch
> nosy: +santa4nt
> Added file: http://bugs.python.org/file21310/timeoutsec.patch
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue11613>
> _______________________________________
>
msg131680 - (view) Author: Reid Kleckner (rnk) (Python committer) Date: 2011-03-21 17:42
The bot is green again as of ab2363f89058.  Thanks for the heads up.
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55822
2011-03-21 17:42:00rnksetstatus: open -> closed
nosy: pitrou, rnk, santoso.wijaya
messages: + msg131680
2011-03-20 21:07:23rnksetnosy: pitrou, rnk, santoso.wijaya
messages: + msg131543
2011-03-20 21:03:20santoso.wijayasetfiles: + timeoutsec.patch
nosy: pitrou, rnk, santoso.wijaya
messages: + msg131542
2011-03-20 20:57:16santoso.wijayasetfiles: - timeoutsec.patch
nosy: pitrou, rnk, santoso.wijaya
2011-03-20 20:46:20santoso.wijayasetfiles: + timeoutsec.patch

nosy: + santoso.wijaya
messages: + msg131539

keywords: + patch
2011-03-20 12:05:50pitroucreate