[MERGE] More than double the speed of "bzr selftest"
John Arbash Meinel
john at arbash-meinel.com
Thu Jun 7 17:57:21 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> Here's my overall bundle for this. It takes it further than Andrew
> did, removing --keep-output and always storing the test directories in
> TMPDIR, which makes things faster overall.
>
I just ran into a problem with this. You are using "atexit()" to register a
cleanup function.
However, 'bzr' the front-end uses 'os._exit()' rather that sys.exit because we
don't feel like wasting time cleaning up after ourselves.
IIRC we did this because:
a) it was significantly faster than running all of the deconstructors and
python cleanup
b) It avoided certain problems with classes dying and causing they
deconstructors to do weird things (because they were trying to cleanup
against modules that were no longer loaded, etc)
But that means that atexit() no longer runs, so we won't be cleaning up our
temporary directories.
To fix this, I think we can just extend our TestSuiteRunner so that we can
setup things for it to run after everything is done.
I ran across this because I was trying to use similar functionality in a
plugin's test suite, and I was finding that tempfile.NamedTemporaryFile was not
cleaning itself up.
I'm only creating 1 named temporary file per invocation, but when you run the
test suite every couple of minutes, that starts leaving a lot of cruft.
Any thoughts about how to do this cleanly? I suppose we could have 'bzr' detect
if it is running the test suite, and if so, it will use sys.exit() instead of
os._exit()
We could even have this as a bzrlib variable "bzrlib.exit_cleanly = True" or
something like that.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGaDjwJdeBCYSNAAMRAg/4AKDPCaMEACmxgt7yvuTeFrezSL1F0wCglrj+
TGV3OE72D9+ZH/Y6yNd9O1Q=
=dqoy
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list