From 6f82c9979b864f1608f1665924db08510c2f50ff Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 7 Jul 2020 22:31:17 -0700 Subject: [PATCH] Add #339 to NEWS and add test. --- NEWS | 3 +++ setup.py | 2 +- tests/integration/test_execute.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 84a7fd87c..71abecc22 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.5.9.dev0 + * #339: Fix for intermittent timing-related test failure of logging function. + 1.5.8 * #336: Fix for traceback when running Cronitor, Cronhub, and PagerDuty monitor hooks. diff --git a/setup.py b/setup.py index 8dc856b02..3262f03dd 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = '1.5.8' +VERSION = '1.5.9.dev0' setup( diff --git a/tests/integration/test_execute.py b/tests/integration/test_execute.py index 01973f8ef..0484f6e32 100644 --- a/tests/integration/test_execute.py +++ b/tests/integration/test_execute.py @@ -143,3 +143,16 @@ def test_log_outputs_with_no_output_logs_nothing(): module.log_outputs( (process,), exclude_stdouts=(), output_log_level=logging.INFO, borg_local_path='borg' ) + + +def test_log_outputs_with_unfinished_process_re_polls(): + flexmock(module.logger).should_receive('log').never() + flexmock(module).should_receive('exit_code_indicates_error').and_return(False) + + process = subprocess.Popen(['true'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + flexmock(process).should_receive('poll').and_return(None).and_return(0).twice() + flexmock(module).should_receive('output_buffer_for_process').and_return(process.stdout) + + module.log_outputs( + (process,), exclude_stdouts=(), output_log_level=logging.INFO, borg_local_path='borg' + )