Skip to content

Commit 02b4cd2

Browse files
committed
🐛 fix(coverage): exclude tkinter test on 3.12 CI
1 parent 96a136e commit 02b4cd2

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

tests/test_py_info_extra.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
from py_discovery._py_info import VersionInfo
1515

1616
try:
17-
import tkinter as tk # noqa: F401
18-
19-
_HAS_TKINTER = True
17+
import tkinter as tk # pragma: no cover
2018
except ImportError: # pragma: no cover
21-
_HAS_TKINTER = False
19+
tk = None # type: ignore[assignment]
2220

2321
if TYPE_CHECKING:
2422
from pathlib import Path
@@ -53,12 +51,10 @@ def test_get_tcl_tk_libs_returns_tuple() -> None:
5351
assert tk is None or isinstance(tk, str)
5452

5553

56-
@pytest.mark.skipif(not _HAS_TKINTER, reason="tkinter not available")
57-
def test_get_tcl_tk_libs_tcl_error(mocker) -> None:
58-
import tkinter as tk
59-
54+
@pytest.mark.skipif(tk is None, reason="tkinter not available")
55+
def test_get_tcl_tk_libs_tcl_error(mocker) -> None: # pragma: no cover
6056
mock_tcl = MagicMock()
61-
mock_tcl.eval.side_effect = tk.TclError("fail")
57+
mock_tcl.eval.side_effect = tk.TclError("fail") # type: ignore[union-attr]
6258
mocker.patch("tkinter.Tcl", return_value=mock_tcl)
6359

6460
tcl, _tk = PythonInfo._get_tcl_tk_libs()

0 commit comments

Comments
 (0)