summaryrefslogtreecommitdiff
path: root/cherrypy
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-10-25 21:58:16 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-10-25 21:58:16 -0400
commitb8be914dfff42e29eecaf0b5ac7e6896abb91ed2 (patch)
treef2e2fbbb38b9644de6bb8a02d944481833e7f8b3 /cherrypy
parent119f9271dd3d1deda3df12308dfcd9cc96728efc (diff)
downloadcherrypy-git-b8be914dfff42e29eecaf0b5ac7e6896abb91ed2.tar.gz
Update test_signal_handler_unsubscribe to not hard-code the number of lines back in the log that the message appears.
Diffstat (limited to 'cherrypy')
-rw-r--r--cherrypy/test/test_states.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cherrypy/test/test_states.py b/cherrypy/test/test_states.py
index 4f35f5fb..a1694436 100644
--- a/cherrypy/test/test_states.py
+++ b/cherrypy/test/test_states.py
@@ -420,9 +420,11 @@ test_case_name: "test_signal_handler_unsubscribe"
p.join()
# Assert the old handler ran.
- target_line = open(p.error_log, 'rb').readlines()[-10]
- if not ntob('I am an old SIGTERM handler.') in target_line:
- self.fail('Old SIGTERM handler did not run.\n%r' % target_line)
+ log_lines = list(open(p.error_log, 'rb'))
+ assert any(
+ line.endswith(b'I am an old SIGTERM handler.\n')
+ for line in log_lines
+ )
class WaitTests(unittest.TestCase):