1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
From: Roland Mas <roland.mas@entierement.net>
Date: Fri, 15 Nov 2024 16:01:38 +0100
Subject: Skip tests that require networking
---
pyproject.toml | 3 +++
tests/test_qt/test_demos.py | 1 +
tests/test_qt/test_qmainwindow.py | 2 ++
tests/test_qt/test_qmenu.py | 2 ++
4 files changed, 8 insertions(+)
diff --git a/pyproject.toml b/pyproject.toml
index 3376232..e0c95c6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -156,6 +156,9 @@ filterwarnings = [
"ignore:Failing to pass a value to the 'type_params' parameter::pydantic",
"ignore:`__get_validators__` is deprecated and will be removed",
]
+markers = [
+ "needs_network: This test requires network access",
+]
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
diff --git a/tests/test_qt/test_demos.py b/tests/test_qt/test_demos.py
index 7fa13ae..3cf17e7 100644
--- a/tests/test_qt/test_demos.py
+++ b/tests/test_qt/test_demos.py
@@ -7,6 +7,7 @@ from qtpy.QtWidgets import QApplication
DEMO = Path(__file__).parent.parent.parent / "demo"
+@pytest.mark.needs_network
@pytest.mark.parametrize("fname", ["qapplication.py", "model_app.py", "multi_file"])
def test_qapp(qapp, fname, monkeypatch) -> None:
monkeypatch.setattr(QApplication, "exec", lambda *a, **k: None)
diff --git a/tests/test_qt/test_qmainwindow.py b/tests/test_qt/test_qmainwindow.py
index a31b137..e2a8771 100644
--- a/tests/test_qt/test_qmainwindow.py
+++ b/tests/test_qt/test_qmainwindow.py
@@ -2,6 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
+import pytest
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QAction, QApplication
@@ -14,6 +15,7 @@ if TYPE_CHECKING:
from ..conftest import FullApp # noqa: TID252
+@pytest.mark.needs_network
def test_qmodel_main_window(
qtbot: QtBot, qapp: QApplication, full_app: FullApp
) -> None:
diff --git a/tests/test_qt/test_qmenu.py b/tests/test_qt/test_qmenu.py
index 359a484..3175f4e 100644
--- a/tests/test_qt/test_qmenu.py
+++ b/tests/test_qt/test_qmenu.py
@@ -18,6 +18,7 @@ SEP = ""
LINUX = sys.platform.startswith("linux")
+@pytest.mark.needs_network
@pytest.mark.parametrize("MenuCls", [QModelMenu, QModelToolBar])
def test_menu(
MenuCls: type[QModelMenu] | type[QModelToolBar], qtbot: QtBot, full_app: FullApp
@@ -151,6 +152,7 @@ def test_toggled_menu_item(qtbot: QtBot, full_app: FullApp) -> None:
assert not action.isChecked()
+@pytest.mark.needs_network
@pytest.mark.parametrize("MenuCls", [QModelMenu, QModelToolBar])
def test_menu_events(
MenuCls: type[QModelMenu] | type[QModelToolBar], qtbot: QtBot, full_app: FullApp
|