From bdc6fd2f8b5df86f7a6370b67212e4c898351c4e Mon Sep 17 00:00:00 2001 From: david-sarah Date: Mon, 19 Jul 2010 18:13:45 -0700 Subject: [PATCH] test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings). --- src/allmydata/test/test_runner.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index c617dd62..5ff10ba7 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -31,7 +31,7 @@ class SkipMixin: raise unittest.SkipTest("twistd does not fork under windows") -class TheRightCode(common_util.SignalMixin, unittest.TestCase, SkipMixin): +class BinTahoe(common_util.SignalMixin, unittest.TestCase, SkipMixin): def test_path(self): self.skip_if_cannot_run_bintahoe() d = utils.getProcessOutputAndValue(bintahoe, args=["--version-and-path"], env=os.environ) @@ -48,6 +48,24 @@ class TheRightCode(common_util.SignalMixin, unittest.TestCase, SkipMixin): d.addCallback(_cb) return d + def test_version_no_noise(self): + self.skip_if_cannot_run_bintahoe() + import pkg_resources + try: + pkg_resources.require("Twisted>=9.0.0") + except pkg_resources.VersionConflict: + raise unittest.SkipTest("We pass this test only with Twisted >= v9.0.0") + + d = utils.getProcessOutputAndValue(bintahoe, args=["--version"], env=os.environ) + def _cb(res): + out, err, rc_or_sig = res + self.failUnlessEqual(rc_or_sig, 0, res) + self.failUnless(out.startswith("allmydata-tahoe:"), res) + self.failIfIn("DeprecationWarning", out, res) + self.failUnlessEqual(err, "", res) + d.addCallback(_cb) + return d + class CreateNode(unittest.TestCase): # exercise "tahoe create-node", create-introducer, -- 2.45.2