Fix un-assignment local variable 'returncode' error
This commit fixes an error "local variable 'returncode' referenced
before assignment" when we run 'tempest run' with having a
testrepository.
Change-Id: I99425de8481db4bddbe06b715bcceaaadaa1a797
diff --git a/tempest/cmd/run.py b/tempest/cmd/run.py
index e78f6b0..26bd418 100644
--- a/tempest/cmd/run.py
+++ b/tempest/cmd/run.py
@@ -70,6 +70,7 @@
def take_action(self, parsed_args):
self._set_env()
+ returncode = 0
# Local execution mode
if os.path.isfile('.testr.conf'):
# If you're running in local execution mode and there is not a
@@ -77,8 +78,8 @@
if not os.path.isdir('.testrepository'):
returncode = run_argv(['testr', 'init'], sys.stdin, sys.stdout,
sys.stderr)
- if returncode:
- sys.exit(returncode)
+ if returncode:
+ sys.exit(returncode)
else:
print("No .testr.conf file was found for local execution")
sys.exit(2)