[PATCH] Small fixes to TestCaseWithMemoryTransport

John Arbash Meinel john at arbash-meinel.com
Wed Jan 10 17:08:04 GMT 2007


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

Vincent Ladeuil wrote:
> There was a little bit of inconsistency with the failIfExists and
> failUnlessExists methods: they were testing the existence of the
> file on disk.
> 
> I defined failUnlessExistsOnDisk and failIfExistsOnDisk for that
> and pushed down the existing ones into TestCaseInTempDir.
> 
>     Vincent
> 

...

> === modified file bzrlib/tests/__init__.py
> --- bzrlib/tests/__init__.py
> +++ bzrlib/tests/__init__.py
> @@ -1262,14 +1262,20 @@
>          self.transport_server = default_transport
>          self.transport_readonly_server = None
>  
> -    def failUnlessExists(self, path):
> -        """Fail unless path, which may be abs or relative, exists."""
> +    def failUnlessExistsOnDisk(self, path):
> +        """Fail unless path, which may be abs or relative, exists.
> +
> +        This method is used mainly to detect leaks.
> +        """
>          self.failUnless(osutils.lexists(path))
>  
> -    def failIfExists(self, path):
> -        """Fail if path, which may be abs or relative, exists."""
> +    def failIfExistsOnDisk(self, path):
> +        """Fail if path, which may be abs or relative, exists..
> +
> +        This method is used mainly to detect leaks.
> +        """
>          self.failIf(osutils.lexists(path))
> -        
> +
>      def get_transport(self):
>          """Return a writeable transport for the test scratch space"""
>          t = get_transport(self.get_url())
> @@ -1541,6 +1547,10 @@
>                  #   put:    4.5-7.5s (averaging 6s)
>                  #   append: 2.9-4.5s
>                  #   put_non_atomic: 2.9-4.5s
> +
> +                # ^ jam, is that comment still valid ? I think we
> +                # can safely use put_bytes_non_atomic instead of
> +                # put_file, given that put is deprecated -- vila 20070110
>                  transport.put_bytes_non_atomic(urlutils.escape(name), content)

^- I don't think the comment really helps anymore, so we might as well
just delete all of the comments.
It was mostly that put() was much slower than append() but
put_non_atomic() was approximately the same speed as append.

Obviously these command names have changed with deprecations and
addition of the new *bytes/file* forms. So just nuke the whole comment
section.

Otherwise, +1 from me. And for me, since it is only changing the test
suite, I'm okay with it being merged for 0.14, but I'll let Wouter make
the final decision.

John
=:->

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

iD8DBQFFpR10JdeBCYSNAAMRAoh7AJ9OmHHn+xJ61UB0VxZYsRiesVH2GwCfYiix
pf+Y+AyrxIsZ1f30bVT6bIU=
=pBTf
-----END PGP SIGNATURE-----



More information about the bazaar mailing list