The load error is intentional (it is a bad module name).
But the test expects the stringified exception
bad
while on the second execution it gets:
No module named 'breezy.testingplugins.some_error'
This checked error message comes from breezy/plugin.py
It is set by:
return record_plugin_warning(
'Unable to load plugin %r from %r: %s' % (name, dir, e))
On the first call the exception is of type 'Exception', the second time 'ModuleNotFoundError'.
The test prepares a simple .py file "some_error.py" which contains the
raise Exception("bad")
which it checks upon.
The load does directly call __import__ with the same string each time.
__import__("breezy.testingplugins.some_error")
In the good case the raised exception thereby is like:
File "/build/breezy-xbGxjH/breezy-3.2.1/breezy/plugin.py", line 431, in _load_plugin_module
__import__(_MODULE_PREFIX + name)
File "/tmp/testbzr-e53aok06.tmp/breezy.tests.test_plugins.TestLoadingPlugins.test_plugin_with_error/work/./some_error.py", line 1, in <module>
raise Exception("bad")
And in the bad case it does not find the file.
If I call the __import__ function myself twice it reports "ModuleNotFoundError" every time.
Semething in the setup must make it able to load that and this is what breaks in the second execution.
The load error is intentional (it is a bad module name). testingplugins. some_error'
But the test expects the stringified exception
bad
while on the second execution it gets:
No module named 'breezy.
This checked error message comes from breezy/plugin.py plugin_ warning(
It is set by:
return record_
'Unable to load plugin %r from %r: %s' % (name, dir, e))
On the first call the exception is of type 'Exception', the second time 'ModuleNotFound Error'.
The test prepares a simple .py file "some_error.py" which contains the
raise Exception("bad")
which it checks upon.
The load does directly call __import__ with the same string each time. _("breezy. testingplugins. some_error" )
__import_
In the good case the raised exception thereby is like: breezy- xbGxjH/ breezy- 3.2.1/breezy/ plugin. py", line 431, in _load_plugin_module _(_MODULE_ PREFIX + name) e53aok06. tmp/breezy. tests.test_ plugins. TestLoadingPlug ins.test_ plugin_ with_error/ work/./ some_error. py", line 1, in <module>
File "/build/
__import_
File "/tmp/testbzr-
raise Exception("bad")
And in the bad case it does not find the file. Error" every time.
If I call the __import__ function myself twice it reports "ModuleNotFound
Semething in the setup must make it able to load that and this is what breaks in the second execution.