-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevents duplicate loading of plugins
In cases of multiple load_plugins calls Adds test for future proofing
- Loading branch information
1 parent
7a834e7
commit a2ddda8
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from unittest.mock import patch | ||
|
||
from glue.main import load_plugins | ||
|
||
|
||
def test_no_duplicate_loading(capsys): | ||
""" | ||
Regression test for duplicated loading of plugins | ||
on subsequent calls of `load_plugins()` after initial | ||
glue-qt startup. | ||
""" | ||
from glue.logger import logger | ||
|
||
with patch.object(logger, 'info') as info: | ||
load_plugins() | ||
|
||
for acall in info.call_args_list: | ||
if 'Loading plugin' in acall[0][0]: | ||
assert 'failed' in acall[0][0] |