From 87aa33ecc41b82a48d1fc681a1df5d6012155f95 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Fri, 21 Oct 2022 17:03:48 -0600 Subject: [PATCH] `zcash --help` test improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applying suggestions from @daira’s review of #6204. Co-authored-by: Daira Hopwood --- qa/rpc-tests/show_help.py | 5 +---- qa/rpc-tests/test_framework/util.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/qa/rpc-tests/show_help.py b/qa/rpc-tests/show_help.py index f20662536..eb0d473d5 100755 --- a/qa/rpc-tests/show_help.py +++ b/qa/rpc-tests/show_help.py @@ -12,7 +12,6 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, assert_true, zcashd_binary import subprocess import tempfile -import time help_message = """ In order to ensure you are adequately protecting your privacy when using Zcash, @@ -489,9 +488,7 @@ class ShowHelpTest(BitcoinTestFramework): def show_help(self): with tempfile.SpooledTemporaryFile(max_size=2**16) as log_stdout: args = [ zcashd_binary(), "--help" ] - process = subprocess.Popen(args, stdout=log_stdout) - while process.poll() is None: - time.sleep(0.25) + process = subprocess.run(args, stdout=log_stdout) assert_equal(process.returncode, 0) log_stdout.seek(0) stdout = log_stdout.read().decode('utf-8') diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 90b127f4e..20c732349 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -443,7 +443,7 @@ def assert_start_raises_init_error(i, dirname, extra_args=None, expected_msg=Non if expected_msg is None: assert_msg = "%s should have exited with an error" % (zcashd_binary(),) else: - assert_msg = "%s should have exited with expected error %s" % (zcashd_binary(), expected_msg) + assert_msg = "%s should have exited with expected error %r" % (zcashd_binary(), expected_msg) raise AssertionError(assert_msg) def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None):