From: david-sarah Date: Tue, 20 Jul 2010 01:13:45 +0000 (-0700) Subject: test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings). X-Git-Tag: trac-4600~16 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/flags/webapi.txt?a=commitdiff_plain;h=bdc6fd2f8b5df86f7a6370b67212e4c898351c4e;p=tahoe-lafs%2Ftahoe-lafs.git test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings). --- 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,