[patch] test_source should avoid walking into temporary directories
John Arbash Meinel
john at arbash-meinel.com
Tue Oct 31 16:10:07 GMT 2006
Martin Pool wrote:
> As the subject says. If you happen to have several old test directories
> around it can take a long time or cause spurious failures. (We
> sometimes create sample files called *.py).
>
> === modified file 'bzrlib/tests/test_source.py'
> --- bzrlib/tests/test_source.py 2006-10-18 04:45:50 +0000
> +++ bzrlib/tests/test_source.py 2006-10-31 04:28:50 +0000
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2005 Canonical Ltd
> +# Copyright (C) 2005, 2006 Canonical Ltd
> # Authors: Robert Collins <robert.collins at canonical.com>
> #
> # This program is free software; you can redistribute it and/or modify
> @@ -114,6 +114,9 @@
> yield bzr_path
> for root, dirs, files in os.walk(bzrlib_dir):
> + for d in dirs:
> + if d.endswith('.tmp'):
> + dirs.remove(d)
> for f in files:
> if not f.endswith('.py'):
> continue
v- +1, except you need some extra whitespace here:
> @@ -154,6 +157,14 @@
> return False
> + def test_tmpdir_not_in_source_files(self):
> + """When scanning for source files, we don't descend test
> tempdirs"""
> + for filename in self.get_source_files():
> + if re.search(r'test....\.tmp', filename):
> + self.fail("get_source_file() returned filename %r "
> + "from within a temporary directory"
> + % filename)
> +
> def test_copyright(self):
> """Test that all .py files have a valid copyright statement"""
> # These are files which contain a different copyright statement
>
>
> --Martin
>
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061031/38b04a20/attachment.pgp
More information about the bazaar
mailing list