patch: more sftp unit tests
Wouter van Heyst
larstiq at larstiq.dyndns.org
Tue Jan 10 14:55:29 GMT 2006
<snip>
> - ret,stats = profile(the_callable,*args,**kwargs)
> + import cPickle
> + ret, stats = profile(the_callable, *args, **kwargs)
> stats.sort()
> - stats.pprint()
> + if filename is None:
> + stats.pprint()
> + else:
> + stats.freeze()
> + cPickle.dump(stats, open(filename, 'w'), 2)
> + print 'Profile data written to %r.' % filename
> return ret
No pprinting when dumping? I can live with that, but perhaps both would
be nice.
> - for a in argv:
> + argv_copy = []
> + i = 0
> + while i < len(argv):
> + a = argv[i]
> if a == '--profile':
> opt_profile = True
> elif a == '--lsprof':
> opt_lsprof = True
> + elif a == '--lsprof-file':
> + opt_lsprof_file = argv[i + 1]
> + i += 1
> elif a == '--no-plugins':
> opt_no_plugins = True
> elif a == '--builtin':
> @@ -501,9 +514,10 @@
> elif a in ('--quiet', '-q'):
> be_quiet()
> else:
> - continue
> - argv.remove(a)
> -
> + argv_copy.append(a)
> + i += 1
> +
> + argv = argv_copy
Why not just use something like:
for a in in list(argv):
argv.remove(a)
Also, bzrlib/weave.py has a main entry point with lsprof, that should
either go away or be in sync.
Wouter van Heyst
More information about the bazaar
mailing list