More test coverage, remove unused functions from editor.py
This commit is contained in:
parent
ada1d8ffad
commit
66950eeff5
6 changed files with 301 additions and 18 deletions
14
tests/test_main_module.py
Normal file
14
tests/test_main_module.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import runpy
|
||||
import types
|
||||
import sys
|
||||
import builtins
|
||||
|
||||
def test_dunder_main_executes_without_launching_qt(monkeypatch):
|
||||
# Replace bouquin.main with a stub that records invocation and returns immediately
|
||||
calls = {"called": False}
|
||||
mod = types.SimpleNamespace(main=lambda: calls.__setitem__("called", True))
|
||||
monkeypatch.setitem(sys.modules, "bouquin.main", mod)
|
||||
|
||||
# Running the module as __main__ should call mod.main() but not start a Qt loop
|
||||
runpy.run_module("bouquin.__main__", run_name="__main__")
|
||||
assert calls["called"] is True
|
||||
Loading…
Add table
Add a link
Reference in a new issue