[Pytest-commit] Issue #761: Capturing stdout on Windows seems to cause lockup and 100% CPU usage (pytest-dev/pytest)

Graham Markall issues-reply at bitbucket.org
Tue Jun 2 15:13:36 CEST 2015


New issue 761: Capturing stdout on Windows seems to cause lockup and 100% CPU usage
https://bitbucket.org/pytest-dev/pytest/issue/761/capturing-stdout-on-windows-seems-to-cause

Graham Markall:

On Windows 7 with Python 3.4.3 capturing stdout seems to keep hold of stdout after `pytest.main` is finished, and sends CPU usage to 100%. For example, I created a file, m.py, which containts only:


```
#!python

print('Test')
```

if I then run pytest with `pytest.main()` and allow it to capture stdout, like:


```
C:\Users\gmarkall\tmp\pytest>python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar  6 2015, 12:06:10) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytest
>>> pytest.main('--pyargs m')
============================= test session starts =============================
platform win32 -- Python 3.4.3 -- py-1.4.27 -- pytest-2.7.1
rootdir: C:\Users\gmarkall\tmp\pytest, inifile:
collected 0 items

==============================  in 0.00 seconds ===============================
0
>>>

```

then at this point I can no longer enter any input into the interpreter (though pressing Ctrl+C does cause `KeyboardInterrupt` to pop up). 

However, invoking with `-s` leaves everything working as expected:

```
 C:\Users\gmarkall\tmp\pytest>python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar  6 2015, 12:06:10) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytest
>>> pytest.main('-s --pyargs m')
============================= test session starts =============================
platform win32 -- Python 3.4.3 -- py-1.4.27 -- pytest-2.7.1
rootdir: C:\Users\gmarkall\tmp\pytest, inifile:
collecting 0 itemsTest
collected 0 items

==============================  in 0.02 seconds ===============================
0
>>>
```

and at this point I can still interact with the Python interpreter.




More information about the pytest-commit mailing list