[MERGE] Try harder to avoid loading plugins during the test suite.

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jan 8 07:54:07 GMT 2009


>>>>> "Andrew" == Andrew Bennetts <andrew.bennetts at canonical.com> writes:

<snip/>

    >> AFAIUI, --no-plugins is handled once for a given process by
    >> calling bzrlib.plugin.disable_plugins() which calls
    >> bzrlib.plugin.load_plugins([]) which in turn set a plugin._loaded
    >> to True which ensures that we will never load plugins in that
    >> process.

    Andrew> Well, I think my reasoning was that we shouldn't be
    Andrew> accidentally loading plugins at this point, and
    Andrew> calling disable_plugins() after plugins have been
    Andrew> loaded is harmless.

    Andrew> That said, I don't think this is necessary now;

Great.


<snip/>

    >> Can you tell us *how* you produce tracebacks ?

    Andrew> I run the full test suite, with “bzr --no-plugins selftest”, and get an
    Andrew> error like this:

<snip/>

    Andrew>   File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/__init__.py", line 158, in lazy_check_versions
    Andrew>     bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
    Andrew>   File "/home/andrew/warthogs/bzr/bencode-tweak/bzrlib/api.py", line 104, in require_any_api
    Andrew>     require_api(object_with_api, wanted_api_list[-1])
    Andrew>   File "/home/andrew/warthogs/bzr/bencode-tweak/bzrlib/api.py", line 82, in require_api
    Andrew>     raise IncompatibleAPI(object_with_api, wanted_api, minimum, current)
    Andrew> IncompatibleAPI: The API for "<module 'bzrlib' from '/home/andrew/warthogs/bzr/bencode-tweak/bzrlib/__init__.pyc'>" is not compatible with "(1, 10, 0)". It supports versions "(1, 11, 0)" to "(1, 11, 0)".

svn, that explained why I couldn't reproduce it, thanks.

<snip/>

    >> I can't go further without a recipe to reproduce the
    >> problem, but I think a cleaner approach would be to not
    >> *load* test_plugins if --no-plugins is passed on the
    >> command-line...

    Andrew> No, I disagree.  test_plugins shouldn't need to
    Andrew> change the global state

Indeed. I agree with that.

<snip/>

    Andrew> I've attached a patch that does so.

BB:approve

        Vincent

<snip/>

    Andrew> Maybe we need --no-non-core-plugins ;)

    Andrew> I'd settle for --no-plugins-with-slow-or-buggy-test-suites.

Patches welcome  ! :-)




More information about the bazaar mailing list