From 4a53ad73eb4468796317bd1e44273a80b3ec9385 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 27 Mar 2015 13:15:17 +0100 Subject: testutils: Add a context manager to capture stderr and use it to test the help output --- tests/11_test_dch_main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/11_test_dch_main.py') diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py index 4f27131..538d2e8 100644 --- a/tests/11_test_dch_main.py +++ b/tests/11_test_dch_main.py @@ -4,7 +4,7 @@ from . import context from .testutils import (DebianGitTestRepo, OsReleaseFile, - get_dch_default_urgency) + get_dch_default_urgency, capture_stderr) from gbp.scripts import dch @@ -191,7 +191,9 @@ class TestScriptDch(DebianGitTestRepo): def test_dch_main_new_upstream_version_with_snapshot_release(self): """Test dch.py like gbp dch script does: new upstream version - snapshot - release""" options = ["--snapshot", "--release"] - self.assertRaises(SystemExit, self.run_dch, options) + with capture_stderr() as c: + self.assertRaises(SystemExit, self.run_dch, options) + self.assertTrue("'--snapshot' and '--release' are incompatible options" in c.output()) def test_dch_main_new_upstream_version_with_distribution(self): -- cgit v1.2.3