runner.py: add --quiet, use it from test cases

This commit is contained in:
Brian Warner 2007-04-23 21:17:13 -07:00
parent 8307aaccb6
commit d1a848e0a7
2 changed files with 13 additions and 5 deletions
src/allmydata

@ -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']

@ -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")))