From 2b3e2e88f7e6fbed20b7c32d09b95dd261681428 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 16 Jan 2018 11:03:06 -0500 Subject: [PATCH] Fix load command in pdb/no-discover path This commit fixes a small oversight in the ostestr --pdb/--no-discover path. When we go to load the results from the run the command used to load the results was still using testrepository, which is not used anywhere else in ostestr at this point.(and is not in requirements.txt anymore) This commit fixes this and switches it to use stestr instead. That also exposed another bug in that code path where it was assuming a repository was created before ostestr was run which is fixed as part of this commit. Change-Id: Icb3492ab0f08248a33f711807b150b4a9748fda6 --- os_testr/ostestr.py | 4 +++- os_testr/tests/test_ostestr.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/os_testr/ostestr.py b/os_testr/ostestr.py index 4edc216..0b79d64 100755 --- a/os_testr/ostestr.py +++ b/os_testr/ostestr.py @@ -184,7 +184,9 @@ def call_testr(regex, subunit, pretty, list_tests, slowest, parallel, concur, def call_subunit_run(test_id, pretty, subunit): env = copy.deepcopy(os.environ) - cmd_save_results = ['testr', 'load', '--subunit'] + cmd_save_results = ['stestr', 'load', '--subunit'] + if not os.path.isdir('.stestr'): + commands.init_command() if pretty: # Use subunit run module diff --git a/os_testr/tests/test_ostestr.py b/os_testr/tests/test_ostestr.py index 8ce2062..1d94074 100644 --- a/os_testr/tests/test_ostestr.py +++ b/os_testr/tests/test_ostestr.py @@ -142,7 +142,7 @@ class TestCallers(base.TestCase): msg = "Function %s not called" function = ['python', '-m', 'subunit.run', 'project.tests.foo'] self.assertIn(function, called[0][0], msg % 'subunit.run') - function = ['testr', 'load', '--subunit'] + function = ['stestr', 'load', '--subunit'] self.assertIn(function, called[1][0], msg % 'testr load') function = ['subunit-trace', '--no-failure-debug', '-f'] self.assertIn(function, called[2][0], msg % 'subunit-trace') @@ -166,7 +166,7 @@ class TestCallers(base.TestCase): # Validate Popen called the right function called = mock_popen.call_args - function = ['testr', 'load', '--subunit'] + function = ['stestr', 'load', '--subunit'] self.assertIn(function, called[0], "testr load not called") def test_call_subunit_run_testtools(self):