xolox / python-capturer

Easily capture stdout/stderr of the current process and subprocesses
https://capturer.readthedocs.io
MIT License
30 stars 7 forks source link

Issue on macOS 10.15.6/Python 3.8.5 #10

Open d3v1an7 opened 4 years ago

d3v1an7 commented 4 years ago

I've been unable to get this running using Python 3.8.5. Was trying to run the example in the README without success, so tried running the test suite instead:

================================================= test session starts ==================================================
platform darwin -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- /Users/d3v1an7/.virtualenvs/capturer/bin/python3
cachedir: .pytest_cache
rootdir: /Users/d3v1an7/workspace/python-capturer, configfile: tox.ini
plugins: cov-2.10.1
collected 14 items

capturer/tests.py::CapturerTestCase::test_carriage_return_interpretation PASSED                                  [  7%]
capturer/tests.py::CapturerTestCase::test_combined_capture_same_process

It essentially freezes on test_combined_capture_same_process "forever". After double keyboard interrupt:

capturer/tests.py::CapturerTestCase::test_combined_capture_same_process ^C^C

---------- coverage: platform darwin, python 3.8.5-final-0 -----------
Coverage HTML written to dir htmlcov

============================================ 1 passed in 192.65s (0:03:12) =============================================

A final third keyboard interrupt shows 3 tracebacks, all for keyboard interrupt (let me know if you'd like these as well).

I really thought it was just me (am new to Python!), but decided to run against 2.7.x (as close as I could get to what is running in Travis) and voila!

================================================= test session starts ==================================================
platform darwin -- Python 2.7.16, pytest-4.6.11, py-1.9.0, pluggy-0.13.1 -- /Users/d3v1an7/.virtualenvs/capturer/bin/python
cachedir: .pytest_cache
rootdir: /Users/d3v1an7/workspace/python-capturer, inifile: tox.ini
plugins: cov-2.10.1
collected 14 items

capturer/tests.py::CapturerTestCase::test_carriage_return_interpretation PASSED                                  [  7%]
capturer/tests.py::CapturerTestCase::test_combined_capture_same_process PASSED                                   [ 14%]
capturer/tests.py::CapturerTestCase::test_combined_capture_subprocess PASSED                                     [ 21%]
capturer/tests.py::CapturerTestCase::test_combined_current_and_subprocess PASSED                                 [ 28%]
capturer/tests.py::CapturerTestCase::test_error_handling PASSED                                                  [ 35%]
capturer/tests.py::CapturerTestCase::test_non_interpreted_lines_capture PASSED                                   [ 42%]
capturer/tests.py::CapturerTestCase::test_partial_read PASSED                                                    [ 50%]
capturer/tests.py::CapturerTestCase::test_save_to_path PASSED                                                    [ 57%]
capturer/tests.py::CapturerTestCase::test_stderr_capture_same_process PASSED                                     [ 64%]
capturer/tests.py::CapturerTestCase::test_stderr_capture_subprocess PASSED                                       [ 71%]
capturer/tests.py::CapturerTestCase::test_stdout_capture_same_process PASSED                                     [ 78%]
capturer/tests.py::CapturerTestCase::test_stdout_capture_subprocess PASSED                                       [ 85%]
capturer/tests.py::CapturerTestCase::test_text_capture PASSED                                                    [ 92%]
capturer/tests.py::CapturerTestCase::test_unmerged_capture PASSED                                                [100%]

---------- coverage: platform darwin, python 2.7.16-final-0 ----------
Coverage HTML written to dir htmlcov

Let me know if you need any other info. Excited to get this working to replace my extremely sketchy asyncio workaround 😂

tobim commented 4 years ago

I get the same problem on macOS 10.14 with python3.8. The tests work with python3.7 on the same host.