]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
runner.py: add --quiet, use it from test cases
authorBrian Warner <warner@lothar.com>
Tue, 24 Apr 2007 04:17:13 +0000 (21:17 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 24 Apr 2007 04:17:13 +0000 (21:17 -0700)
src/allmydata/scripts/runner.py
src/allmydata/test/test_runner.py

index 973ddedec11b21031370bf18be86f54a4635bfd1..81764e49b05d510b1d688c7a0707aa1e4b123c05 100644 (file)
@@ -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']
index 852c7de5a66ce7c0e2098f586065611d63a5efeb..e844e2c960791b76232430bd942321aee685d354 100644 (file)
@@ -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")))