From 3cfe3f6db106566a651734a41c794845299265ac Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 19 Mar 2018 09:54:15 -0400 Subject: [PATCH] Merge #12720: qa: Avoiding 'file' function name from python2 0dbb32b2cb Avoiding 'file' function name from python2 with more descriptive variable naming (Jeff Rade) Pull request description: @jnewbery Here is PR from review in [#12437](https://github.com/bitcoin/bitcoin/pull/12437) Tree-SHA512: c61980f4d3170842627cd970e1f6eebaf303843dc5e95a9dcfe3ded08152be533774cb75f56a83af8452b6bcac17c0172cf20e39edf9acefb4a4c255fe893a3b --- test/functional/test_runner.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 327b52f440..21f3d2ecaf 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -490,7 +490,7 @@ class TestHandler: proc.send_signal(signal.SIGINT) if proc.poll() is not None: log_out.seek(0), log_err.seek(0) - [stdout, stderr] = [file.read().decode('utf-8') for file in (log_out, log_err)] + [stdout, stderr] = [log_file.read().decode('utf-8') for log_file in (log_out, log_err)] log_out.close(), log_err.close() if proc.returncode == TEST_EXIT_PASSED and stderr == "": status = "Passed" @@ -572,7 +572,7 @@ def check_script_list(*, src_dir, fail_on_warn): Check that there are no scripts in the functional tests directory which are not being run by pull-tester.py.""" script_dir = src_dir + '/test/functional/' - python_files = set([file for file in os.listdir(script_dir) if file.endswith(".py")]) + python_files = set([test_file for test_file in os.listdir(script_dir) if test_file.endswith(".py")]) missed_tests = list(python_files - set(map(lambda x: x.split()[0], ALL_SCRIPTS + NON_SCRIPTS))) if len(missed_tests) != 0: print("%sWARNING!%s The following scripts are not being run: %s. Check the test lists in test_runner.py." % (BOLD[1], BOLD[0], str(missed_tests))) @@ -632,8 +632,8 @@ class RPCCoverage(): if not os.path.isfile(coverage_ref_filename): raise RuntimeError("No coverage reference found") - with open(coverage_ref_filename, 'r', encoding="utf8") as file: - all_cmds.update([line.strip() for line in file.readlines()]) + with open(coverage_ref_filename, 'r', encoding="utf8") as coverage_ref_file: + all_cmds.update([line.strip() for line in coverage_ref_file.readlines()]) for root, dirs, files in os.walk(self.dir): for filename in files: @@ -641,8 +641,8 @@ class RPCCoverage(): coverage_filenames.add(os.path.join(root, filename)) for filename in coverage_filenames: - with open(filename, 'r', encoding="utf8") as file: - covered_cmds.update([line.strip() for line in file.readlines()]) + with open(filename, 'r', encoding="utf8") as coverage_file: + covered_cmds.update([line.strip() for line in coverage_file.readlines()]) return all_cmds - covered_cmds