diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-11-02 16:39:47 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-11-02 20:09:40 +0100 |
commit | 23d3880725da4cb92062b5945b7c93202f4ea504 (patch) | |
tree | 4eb1bfde841703c0b29dd5fe1a4307233d895420 /source4 | |
parent | 21be155af839f72375051cf74de76f4487bdc3ea (diff) | |
download | samba-23d3880725da4cb92062b5945b7c93202f4ea504.tar.gz samba-23d3880725da4cb92062b5945b7c93202f4ea504.tar.bz2 samba-23d3880725da4cb92062b5945b7c93202f4ea504.zip |
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
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/netcmd/__init__.py | 7 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/netcmd.py | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py index bf0845726c..58353a07f4 100644 --- a/source4/scripting/python/samba/netcmd/__init__.py +++ b/source4/scripting/python/samba/netcmd/__init__.py @@ -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) diff --git a/source4/scripting/python/samba/tests/netcmd.py b/source4/scripting/python/samba/tests/netcmd.py index d7c6482a46..66646ff00e 100644 --- a/source4/scripting/python/samba/tests/netcmd.py +++ b/source4/scripting/python/samba/tests/netcmd.py @@ -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: |