From b592da1307402843b2c0e4bf914fa5f5daf22777 Mon Sep 17 00:00:00 2001 From: Dan Rue Date: Wed, 7 Jun 2017 16:32:43 -0500 Subject: test-runner: Fix variable overloading flake8 reported the following: test_runner.py:196:25: F402 import 'cmd' from line 4 shadowed by loop variable "cmd" is actually used three different ways in test-runner.py. First, it's an imported module. Second, it's a loop variable. Third, it's re-assigned inside the loop. Change-Id: If907182b4f8229e47321d3819772213bb88791dc Signed-off-by: Dan Rue --- automated/utils/test-runner.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/automated/utils/test-runner.py b/automated/utils/test-runner.py index e5132d3..c374c26 100755 --- a/automated/utils/test-runner.py +++ b/automated/utils/test-runner.py @@ -201,10 +201,11 @@ class TestDefinition(object): f.write('export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin\n') steps = self.testdef['run'].get('steps', []) if steps: - for cmd in steps: - if '--cmd' in cmd or '--shell' in cmd: - cmd = re.sub(r'\$(\d+)\b', r'\\$\1', cmd) - f.write('%s\n' % cmd) + for step in steps: + command = step + if '--cmd' in step or '--shell' in step: + command = re.sub(r'\$(\d+)\b', r'\\$\1', step) + f.write('%s\n' % command) f.write('echo ""\n') os.chmod('%s/run.sh' % self.test['test_path'], 0o755) -- cgit v1.2.3