Remove caching of the alert object in the shared instance
This commit is contained in:
@@ -44,8 +44,7 @@ def testToolDictionaries_Main(qtbot, monkeypatch, nwGUI, fncPath):
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(enchant, "get_user_config_dir", lambda *a: causeException)
|
||||
nwGUI.showDictionariesDialog()
|
||||
assert SHARED.alert is not None
|
||||
assert SHARED.alert.logMessage == "Could not initialise the dialog."
|
||||
assert SHARED.lastAlert == "Could not initialise the dialog."
|
||||
|
||||
# Open the tool
|
||||
nwGUI.showDictionariesDialog()
|
||||
@@ -57,17 +56,16 @@ def testToolDictionaries_Main(qtbot, monkeypatch, nwGUI, fncPath):
|
||||
assert nwDicts.inPath.text() == str(fncPath)
|
||||
|
||||
# Allow Open Dir
|
||||
SHARED._alert = None
|
||||
SHARED._lastAlert = ""
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(QDesktopServices, "openUrl", lambda *a: None)
|
||||
nwDicts._doOpenInstallLocation()
|
||||
assert SHARED.alert is None
|
||||
assert SHARED.lastAlert == ""
|
||||
|
||||
# Fail Open Dir
|
||||
nwDicts.inPath.setText("/foo/bar")
|
||||
nwDicts._doOpenInstallLocation()
|
||||
assert SHARED.alert is not None
|
||||
assert SHARED.alert.logMessage == "Path not found."
|
||||
assert SHARED.lastAlert == "Path not found."
|
||||
nwDicts.inPath.setText(str(fncPath))
|
||||
|
||||
# Create Mock Dicts
|
||||
|
||||
Reference in New Issue
Block a user