# HG changeset patch # User Steve Losh # Date 1254697795 14400 # Node ID e72a3408cc68bc8d61d6788a486b1ad93bf2b625 # Parent e92ab6fb652ea0c503444044def28bcf83cbf474 Add stdout checks to the test suite. diff -r e92ab6fb652e -r e72a3408cc68 review/tests/test_init.py --- a/review/tests/test_init.py Sun Oct 04 19:01:57 2009 -0400 +++ b/review/tests/test_init.py Sun Oct 04 19:09:55 2009 -0400 @@ -2,13 +2,18 @@ from util import * import os +from .. import messages @with_setup(setup_sandbox, teardown_sandbox) def test_init(): sandbox = get_sandbox_repo() + gather_output() review(init=True) + output = grab_output() + + assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') @@ -25,7 +30,11 @@ def test_init_with_local_path(): sandbox = get_sandbox_repo() + gather_output() review(init=True, local_path='codereview') + output = grab_output() + + assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') @@ -42,7 +51,11 @@ def test_init_with_remote_path(): sandbox = get_sandbox_repo() + gather_output() review(init=True, remote_path='../code-review') + output = grab_output() + + assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') @@ -59,7 +72,11 @@ def test_init_with_both_paths(): sandbox = get_sandbox_repo() + gather_output() review(init=True, local_path='codereview', remote_path='../code-review') + output = grab_output() + + assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') diff -r e92ab6fb652e -r e72a3408cc68 review/tests/util.py --- a/review/tests/util.py Sun Oct 04 19:01:57 2009 -0400 +++ b/review/tests/util.py Sun Oct 04 19:09:55 2009 -0400 @@ -37,3 +37,9 @@ def get_datastore_repo(path): return hg.repository(_ui, path) + +def gather_output(): + _ui.pushbuffer() + +def grab_output(): + return _ui.popbuffer()