Merge "Fix un-assignment local variable 'returncode' error"
This commit is contained in:
+3
-2
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user