Return test string in test() function instead of printing it.
This commit is contained in:
parent
7a67446bdd
commit
e2cb9208d1
|
@ -550,7 +550,7 @@ class Baker(object):
|
||||||
|
|
||||||
def test(self, argv=None):
|
def test(self, argv=None):
|
||||||
"""Takes a list of command line arguments, parses it into a command
|
"""Takes a list of command line arguments, parses it into a command
|
||||||
name and options, and prints what the resulting function call would
|
name and options, and returns what the resulting function call would
|
||||||
look like. This may be useful for testing how command line arguments
|
look like. This may be useful for testing how command line arguments
|
||||||
would be passed to your functions.
|
would be passed to your functions.
|
||||||
|
|
||||||
|
@ -560,10 +560,10 @@ class Baker(object):
|
||||||
cmd, args, kwargs = self.parse(argv)
|
cmd, args, kwargs = self.parse(argv)
|
||||||
result = "%s(%s" % (cmd.name, ",".join(repr(a) for a in args))
|
result = "%s(%s" % (cmd.name, ",".join(repr(a) for a in args))
|
||||||
if kwargs:
|
if kwargs:
|
||||||
kws = ", ".join("%s=%r" % (k, v) for k, v in kwargs.iteritems())
|
kws = ",".join("%s=%r" % (k, v) for k, v in kwargs.iteritems())
|
||||||
result += ", " + kws
|
result += "," + kws
|
||||||
result += ")"
|
result += ")"
|
||||||
print result
|
return result
|
||||||
|
|
||||||
|
|
||||||
_baker = Baker()
|
_baker = Baker()
|
||||||
|
|
Loading…
Reference in New Issue