summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Rue <dan.rue@linaro.org>2017-06-07 16:32:43 -0500
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-06-09 09:52:02 +0000
commitb592da1307402843b2c0e4bf914fa5f5daf22777 (patch)
treef9af4a2c13fc86195c4b54d11a176d6d68faa690
parent610c1795bb9c6a1dff499b1ab899caec0404dcb8 (diff)
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 <dan.rue@linaro.org>
-rwxr-xr-xautomated/utils/test-runner.py9
1 files 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 "<ENDRUN $TESTRUN_ID $UUID>"\n')
os.chmod('%s/run.sh' % self.test['test_path'], 0o755)