[MERGE] Fix for Bug 129299, BZR_PLUGIN_PATH should ignore trailiing slashes.
Blake Winton
bwinton at latte.ca
Thu Aug 23 17:49:48 BST 2007
Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Your changes have a failing test case:
> Traceback (most recent call last):
> File "/home/abentley/bzr/foo/bzrlib/tests/test_plugins.py", line 76,
> in test_plugins_with_the_same_name_are_not_loaded
> self.assertEqual(['first'], self.activeattributes[tempattribute])
> AssertionError: not equal:
> a = ['first']
> b = []
This is an interesting one... If I change the name of my test to
test_plugins_zzzcan_load_from_directory_with_trailing_slash, then all of
a sudden this test succeeds and my test fails.
Anyone have any ideas what's going on here? (I'm bwinton on #bzr if you
need more details...)
> Also, many of your lines were wider than 79 chars.
Fixed. Also see below.
> Some had trailing whitespace.
I couldn't find these. Which ones?
> You aren't handling files safely. They should always be explicitly
> closed, because otherwise, Windows may try to delete them before they're
> closed, and fail. Also, it is recommended to use 'open', not 'file' as
> a constructor.
>
> So:
> outfile = open(os.path.join('plugin_test', 'plugin.py'), 'w')
> try:
> print >> outfile, template % (tempattribute, 'plugin')
> finally:
> outfile.close()
These were responsible for most of the >79 character lines. I had
copied the existing tests, preferring to have my code match the other
methods in the file. I have now changed all the tests of that format to
use code similar to the example you've given above.
Thanks,
Blake.
More information about the bazaar
mailing list