why doesn't MemoryServer.tearDown deregister it?

John Arbash Meinel john at arbash-meinel.com
Thu Jan 7 17:55:37 GMT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> We have
> 
> class MemoryServer(Server):
>     """Server for the MemoryTransport for testing with."""
> 
>     def setUp(self):
>         """See bzrlib.transport.Server.setUp."""
>         self._dirs = {'/':None}
>         self._files = {}
>         self._locks = {}
>         self._scheme = "memory+%s:///" % id(self)
>         def memory_factory(url):
>             result = MemoryTransport(url)
>             result._dirs = self._dirs
>             result._files = self._files
>             result._locks = self._locks
>             return result
>         register_transport(self._scheme, memory_factory)
> 
>     def tearDown(self):
>         """See bzrlib.transport.Server.tearDown."""
>         # unregister this server
> 
> 
> why doesn't the tearDown actually deregister it, as it promises to?
> It seems like that would free some memory.  Can we at least add an
> explanatory comment?
> 

I would guess this is just because it wasn't implemented. It should be
simple enough to add:

transport.unregister_transport(self._scheme, self._memory_factory)

I think the big thing is probably when this was written *unregister*
didn't exist. I'm not positive, though.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktGIBkACgkQJdeBCYSNAAOKEQCfRhbk/iC5U6Ef+0O3v2M8JLxt
rTYAn3H1xLDkpjDur1iUDTvM1CMg+aeu
=EGMm
-----END PGP SIGNATURE-----



More information about the bazaar mailing list