summaryrefslogtreecommitdiff
path: root/testrepository/tests/commands
diff options
context:
space:
mode:
authorJonathan Lange <jml@canonical.com>2010-09-20 18:32:43 +0100
committerJonathan Lange <jml@canonical.com>2010-09-20 18:32:43 +0100
commit1db46a6f68fd08eade99ad84228a305a97da0db7 (patch)
tree66fad0efcbcae082eb53b6c8d00b541da70b0fb2 /testrepository/tests/commands
parent85ddf992483d7ce82c0cbe518bf2ed4c7b322621 (diff)
downloadtestrepository-1db46a6f68fd08eade99ad84228a305a97da0db7.tar.gz
Give the UI's TestResult object full responsibility for summing up the result
of the test,
Diffstat (limited to 'testrepository/tests/commands')
-rw-r--r--testrepository/tests/commands/test_failing.py21
-rw-r--r--testrepository/tests/commands/test_load.py9
2 files changed, 26 insertions, 4 deletions
diff --git a/testrepository/tests/commands/test_failing.py b/testrepository/tests/commands/test_failing.py
index de0a9a6..fea9a9a 100644
--- a/testrepository/tests/commands/test_failing.py
+++ b/testrepository/tests/commands/test_failing.py
@@ -51,7 +51,7 @@ class TestCommand(ResourcedTestCase):
# We should have seen test outputs (of the failure) and summary data.
self.assertEqual([
('results', Wildcard),
- ('values', [('failures', 1)])],
+ ('values', [('id', 0), ('tests', 1), ('failures', 1)])],
ui.outputs)
suite = ui.outputs[0][1]
result = testtools.TestResult()
@@ -114,6 +114,16 @@ class TestCommand(ResourcedTestCase):
open = cmd.repository_factory.open
def decorate_open_with_get_failing(url):
repo = open(url)
+ inserter = repo.get_inserter()
+ inserter.startTestRun()
+ class Cases(ResourcedTestCase):
+ def failing(self):
+ self.fail('foo')
+ def ok(self):
+ pass
+ Cases('failing').run(inserter)
+ Cases('ok').run(inserter)
+ inserter.stopTestRun()
orig = repo.get_failing
def get_failing():
calls.append(True)
@@ -122,5 +132,12 @@ class TestCommand(ResourcedTestCase):
return repo
cmd.repository_factory.open = decorate_open_with_get_failing
cmd.repository_factory.initialise(ui.here)
- self.assertEqual(0, cmd.execute())
+ self.assertEqual(1, cmd.execute())
self.assertEqual([True], calls)
+
+ # XXX: Need a test to show what happens when "failing" is called and there
+ # is no previous test run.
+
+ # XXX: Probably should have a test that demonstrates what happens when
+ # "failing" is called and there is a previous test run with no failures.
+
diff --git a/testrepository/tests/commands/test_load.py b/testrepository/tests/commands/test_load.py
index cd76498..180a193 100644
--- a/testrepository/tests/commands/test_load.py
+++ b/testrepository/tests/commands/test_load.py
@@ -98,7 +98,8 @@ class TestCommandLoad(ResourcedTestCase):
cmd.repository_factory.initialise(ui.here)
self.assertEqual(0, cmd.execute())
self.assertEqual(
- [('values', [('id', 0), ('tests', 1), ('skips', 1)])],
+ [('results', Wildcard),
+ ('values', [('id', 0), ('tests', 1), ('skips', 1)])],
ui.outputs)
def test_load_new_shows_test_summary_no_tests(self):
@@ -108,7 +109,9 @@ class TestCommandLoad(ResourcedTestCase):
cmd.repository_factory = memory.RepositoryFactory()
cmd.repository_factory.initialise(ui.here)
self.assertEqual(0, cmd.execute())
- self.assertEqual([('values', [('id', 0), ('tests', 0)])], ui.outputs)
+ self.assertEqual(
+ [('results', Wildcard), ('values', [('id', 0), ('tests', 0)])],
+ ui.outputs)
def test_load_new_shows_test_summary_per_stream(self):
# This may not be the final layout, but for now per-stream stats are
@@ -120,7 +123,9 @@ class TestCommandLoad(ResourcedTestCase):
cmd.repository_factory.initialise(ui.here)
self.assertEqual(0, cmd.execute())
self.assertEqual([
+ ('results', Wildcard),
('values', [('id', 0), ('tests', 0)]),
+ ('results', Wildcard),
('values', [('id', 1), ('tests', 0)])],
ui.outputs)