summaryrefslogtreecommitdiff
path: root/testrepository/tests/commands
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2010-12-07 16:16:41 +1300
committerRobert Collins <robertc@robertcollins.net>2010-12-07 16:16:41 +1300
commit1f73791771a48b6b947ebf6330251eb13e30491a (patch)
tree66eeda7334924c9c6ec64a86437a7bcd0e7289f7 /testrepository/tests/commands
parentd8b50f127e8959c2b4020c0b93be3cd1e899a72e (diff)
downloadtestrepository-1f73791771a48b6b947ebf6330251eb13e30491a.tar.gz
* ``testr load`` and ``testr run`` now have a flag ``--partial``. When set
this will cause existing failures to be preserved. When not set, doing a load will reset existing failures. The ``testr run`` flag ``--failing`` implicitly sets ``--partial`` (so that an interrupted incremental test run does not incorrectly discard a failure record). The ``--partial`` flag exists so that deleted or renamed tests do not persist forever in the database. (Robert Collins)
Diffstat (limited to 'testrepository/tests/commands')
-rw-r--r--testrepository/tests/commands/test_load.py11
-rw-r--r--testrepository/tests/commands/test_run.py21
2 files changed, 32 insertions, 0 deletions
diff --git a/testrepository/tests/commands/test_load.py b/testrepository/tests/commands/test_load.py
index a3c2f78..ee7d777 100644
--- a/testrepository/tests/commands/test_load.py
+++ b/testrepository/tests/commands/test_load.py
@@ -121,3 +121,14 @@ class TestCommandLoad(ResourcedTestCase):
cmd.repository_factory.initialise(ui.here)
self.assertEqual(0, cmd.execute())
self.assertEqual([], ui.outputs)
+
+ def test_partial_passed_to_repo(self):
+ ui = UI([('subunit', '')], [('quiet', True), ('partial', True)])
+ cmd = load.load(ui)
+ ui.set_command(cmd)
+ cmd.repository_factory = memory.RepositoryFactory()
+ cmd.repository_factory.initialise(ui.here)
+ self.assertEqual(0, cmd.execute())
+ self.assertEqual([], ui.outputs)
+ self.assertEqual(True,
+ cmd.repository_factory.repos[ui.here].get_test_run(0)._partial)
diff --git a/testrepository/tests/commands/test_run.py b/testrepository/tests/commands/test_run.py
index b4fd436..405f2fc 100644
--- a/testrepository/tests/commands/test_run.py
+++ b/testrepository/tests/commands/test_run.py
@@ -113,6 +113,9 @@ class TestCommand(ResourcedTestCase):
('results', Wildcard),
('values', [('id', 1), ('tests', 0)])
], ui.outputs)
+ # Failing causes partial runs to be used.
+ self.assertEqual(True,
+ cmd.repository_factory.repos[ui.here].get_test_run(1)._partial)
def test_IDLIST_default_is_empty(self):
ui, cmd = self.get_test_ui_and_cmd()
@@ -192,3 +195,21 @@ class TestCommand(ResourcedTestCase):
{'shell': True, 'stdin': PIPE, 'stdout': PIPE}),
], ui.outputs)
self.assertEqual(0, result)
+
+ def test_partial_passed_to_repo(self):
+ ui, cmd = self.get_test_ui_and_cmd(
+ options=[('quiet', True), ('partial', True)])
+ cmd.repository_factory = memory.RepositoryFactory()
+ self.setup_repo(cmd, ui)
+ self.set_config(
+ '[DEFAULT]\ntest_command=foo\n')
+ result = cmd.execute()
+ expected_cmd = 'foo'
+ self.assertEqual([
+ ('values', [('running', expected_cmd)]),
+ ('popen', (expected_cmd,),
+ {'shell': True, 'stdin': PIPE, 'stdout': PIPE}),
+ ], ui.outputs)
+ self.assertEqual(0, result)
+ self.assertEqual(True,
+ cmd.repository_factory.repos[ui.here].get_test_run(1)._partial)