Skip to content

Commit d8b95df

Browse files
eduralphGaryGriffin
authored andcommitted
GraphView tests: skip only on genuine import absence
The DOT-quoting test guarded its GraphView import with a bare `except Exception`, which would turn an unavailable GI version (ValueError from require_version) or a missing system dependency (GraphView raises if GooCanvas/dot are absent) into a skip that the runner reports as a pass. Narrow the guard to ImportError so only a genuine absence of gi / the addon's Python modules skips; setup problems surface as hard errors instead of silent green. Fixes #13832.
1 parent a7ea500 commit d8b95df

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

GraphView/tests/test_graphview_dot_handles.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@
2424
import unittest
2525
from io import StringIO
2626

27-
# GraphView imports Gtk/GooCanvas at module load; on a host without those
28-
# typelibs (or a display) the import raises. Skip cleanly there rather than
29-
# erroring, so the suite stays runnable without the addon's requires_gi deps.
27+
# GraphView imports gi/GooCanvas at module load. Skip ONLY when those Python
28+
# modules are genuinely absent (ImportError, e.g. PyGObject not installed). A
29+
# wrong/unavailable GI version (ValueError from require_version) or a missing
30+
# system dep (GraphView raises if GooCanvas/dot are absent) must NOT be laundered
31+
# into a skip that reads as success — let it surface as a hard error. The testbed
32+
# image / CI provide these deps and the system-deps drift-guard enforces them.
3033
try:
3134
import gi
3235

3336
gi.require_version("Gtk", "3.0")
3437
from GraphView.graphview import DotSvgGenerator
3538

3639
_IMPORT_ERROR = None
37-
except Exception as err: # pragma: no cover - depends on host gi stack
40+
except ImportError as err: # genuine absence of gi / the addon's Python modules
3841
DotSvgGenerator = None
3942
_IMPORT_ERROR = err
4043

0 commit comments

Comments
 (0)