Merge "Fix un-assignment local variable 'returncode' error"

This commit is contained in:
Jenkins
2016-06-23 00:04:27 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 2 deletions
+3 -2
View File
@@ -70,6 +70,7 @@ class TempestRun(command.Command):
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 @@ class TempestRun(command.Command):
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)
+8
View File
@@ -102,6 +102,14 @@ class TestRunReturnCode(base.TestCase):
subprocess.call(['git', 'init'], stderr=DEVNULL)
self.assertRunExit(['tempest', 'run', '--regex', 'passing'], 0)
def test_tempest_run_passes_with_testrepository(self):
# Git init is required for the pbr testr command. pbr requires a git
# version or an sdist to work. so make the test directory a git repo
# too.
subprocess.call(['git', 'init'], stderr=DEVNULL)
subprocess.call(['testr', 'init'])
self.assertRunExit(['tempest', 'run', '--regex', 'passing'], 0)
def test_tempest_run_fails(self):
# Git init is required for the pbr testr command. pbr requires a git
# version or an sdist to work. so make the test directory a git repo