diff options
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: |