Comment 5 for bug 129299

Revision history for this message
bwinton (bwinton+bzr) wrote :

Okay, I took one of the tests in TestLoadingPlugins, and copied it, and it turned out that I needed to strip trailing slashes in two different places, so I did that, and then while I was there, I couldn't decide whether I should be testing plugin.load_from_path or set_plugins_path, and so I just wrote a test for each. It should all be in the attached patch.

I tried to follow the format of the code as best I could, please let me know if I missed something. Specifically, you might notice that one of my tests has a doc-comment, whereas the other has a doc-string. That's because the other tests in TestLoadingPlugins had doc-comments, whereas the other tests in TestSetPluginsPath had doc-strings...

And I suppose I should mention the reason why I needed to strip trailing slashes twice. I started off only stripping them in set_plugins_path, but load_from_path takes a list of directories, and manually sets plugins.__path__, so to test load_from_path, I needed it to also strip trailing slashes. I did a search through the code to see if anyone called set_plugins_path without passing the return value into load_from_path (so that I could just do the check in load_from_path), but there seemed to be such a call in bzrlib/__init__.py, so it looks like we need to strip the trailing slashes twice.