[merge] call tearDown inside addSkipped()

Alexander Belchenko bialix at ukr.net
Fri Jun 30 05:32:32 BST 2006


+1. Your explanation seems to be very reasonable.

John Arbash Meinel пишет:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Right now the test suite doesn't call tearDown() for a test which is
> skipped. For whatever reason, without calling tearDown() the final
> rmtree() fails on win32. I assume our TestCaseInTempDir is holding
> something open in the final output dir.
> 
> I know you wouldn't get the final os.chdir()
> But it might also have something to do with HOME, or something else. I
> can't say for sure, because it doesn't matter if the test is the last
> one or not. If you have 2 skips, and then 2 successful completions, the
> skipped directories still fail to clean up.
> 
> John
> =:->
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Cygwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFEpEgqJdeBCYSNAAMRAq3KAKCk2sGwSWi6YYTkslnAlcUxVUeikwCgx17F
> MGZzqTwybHZA3Nt/fpbgq5o=
> =vERk
> -----END PGP SIGNATURE-----
> 
> 
> ------------------------------------------------------------------------
> 
> === modified file 'bzrlib/tests/__init__.py'
> --- bzrlib/tests/__init__.py	2006-06-29 16:51:04 +0000
> +++ bzrlib/tests/__init__.py	2006-06-29 21:23:08 +0000
> @@ -262,7 +262,14 @@
>          self.stream.flush()
>          # seems best to treat this as success from point-of-view of unittest
>          # -- it actually does nothing so it barely matters :)
> -        unittest.TestResult.addSuccess(self, test)
> +        try:
> +            test.tearDown()
> +        except KeyboardInterrupt:
> +            raise
> +        except:
> +            self.addError(test, test.__exc_info())
> +        else:
> +            unittest.TestResult.addSuccess(self, test)
>  
>      def printErrorList(self, flavour, errors):
>          for test, err in errors:
> 





More information about the bazaar mailing list