From: Brian Warner Date: Tue, 24 Apr 2007 04:17:13 +0000 (-0700) Subject: runner.py: add --quiet, use it from test cases X-Git-Url: https://git.rkrishnan.org/simplejson//%22news.html/%22?a=commitdiff_plain;h=d1a848e0a740a4db5f9646fabc112eb04a6ced3c;p=tahoe-lafs%2Ftahoe-lafs.git runner.py: add --quiet, use it from test cases --- diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index 973ddede..81764e49 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -22,6 +22,9 @@ class CreateClientOptions(usage.Options): optParameters = [ ["basedir", "C", None, "which directory to create the client in"], ] + optFlags = [ + ["quiet", "q", "operate silently"], + ] def parseArgs(self, *args): if len(args) > 0: @@ -38,6 +41,9 @@ class CreateIntroducerOptions(usage.Options): optParameters = [ ["basedir", "C", None, "which directory to create the introducer in"], ] + optFlags = [ + ["quiet", "q", "operate silently"], + ] def parseArgs(self, *args): if len(args) > 0: @@ -134,8 +140,9 @@ def create_client(config): f = open(os.path.join(basedir, "client.tac"), "w") f.write(client_tac) f.close() - print "client created in %s" % basedir - print " please copy introducer.furl and vdrive.furl into the directory" + if not config['quiet']: + print "client created in %s" % basedir + print " please copy introducer.furl and vdrive.furl into the directory" def create_introducer(config): basedir = config['basedir'] @@ -151,7 +158,8 @@ def create_introducer(config): f = open(os.path.join(basedir, "introducer.tac"), "w") f.write(introducer_tac) f.close() - print "introducer created in %s" % basedir + if not config['quiet']: + print "introducer created in %s" % basedir def start(config): basedir = config['basedir'] diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index 852c7de5..e844e2c9 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -14,7 +14,7 @@ class CreateNode(unittest.TestCase): def test_client(self): basedir = self.workdir("test_client") c1 = os.path.join(basedir, "c1") - argv = ["create-client", "--basedir", c1] + argv = ["create-client", "--basedir", c1, "--quiet"] runner.runner(argv) self.failUnless(os.path.exists(c1)) self.failUnless(os.path.exists(os.path.join(c1, "client.tac"))) @@ -22,7 +22,7 @@ class CreateNode(unittest.TestCase): def test_introducer(self): basedir = self.workdir("test_introducer") c1 = os.path.join(basedir, "c1") - argv = ["create-introducer", "--basedir", c1] + argv = ["create-introducer", "--basedir", c1, "--quiet"] runner.runner(argv) self.failUnless(os.path.exists(c1)) self.failUnless(os.path.exists(os.path.join(c1, "introducer.tac")))