Comment 9 for bug 1937173

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

load_with_paths (tests/test_plugins.py) from sets up the paths that are needed for this to work.
It reached load_plugins (from breezy/plugin.py) with
  path _Path('breezy.testingplugins', [], [], ['.'])

I wondered if the python cache might keep the (failed) module and remember that it failed to load.
And that might make the first load execute code (the one that raises "bad") and the second load fails immediately.

I checked sys.modules.items and tried sys.modules.pop but it never makes it there officially.
So I can't remove it either.
I also changed the name of the module, but that didn't help

I found that I can successfully call self.load_and_capture multiple times with warn_load_problems=False and they are all good.

But any subsequent warn_load_problems=True fails.

True - only working if it is the first
False - always working also later and multiple times.

In the following example
A = test with warn_load_problems=True
B = test with warn_load_problems=False

A - good
A - bad
B - good
B - good
B - good
A - bad
A - bad
B - good
B - good
A - bad
A - bad
A - bad
A - bad

As if we could only get one log, and anything else later does then no more report the raised "bad" but the "ModuleNotFound"