1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

samba.netcmd: Pass in outf/errf.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Wed Nov  2 20:09:40 CET 2011 on sn-devel-104
This commit is contained in:
Jelmer Vernooij 2011-11-02 16:39:47 +01:00
parent 21be155af8
commit 23d3880725
2 changed files with 5 additions and 6 deletions

View File

@ -30,7 +30,6 @@ class Option(optparse.Option):
pass
class Command(object):
"""A samba-tool command."""
@ -63,8 +62,10 @@ class Command(object):
"credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions,
}
outf = sys.stdout
errf = sys.stderr
def __init__(self, outf=sys.stdout, errf=sys.stderr):
self.outf = outf
self.errf = errf
def usage(self, prog, *args):
parser, _ = self._create_parser(prog)

View File

@ -28,9 +28,7 @@ import samba.tests
class NetCmdTestCase(samba.tests.TestCase):
def run_netcmd(self, cmd_klass, args, retcode=0):
cmd = cmd_klass()
cmd.outf = StringIO()
cmd.errf = StringIO()
cmd = cmd_klass(outf=StringIO(), errf=StringIO())
try:
retval = cmd._run(cmd_klass.__name__, *args)
except Exception, e: