Skip to content

Commit 3028865

Browse files
committed
fixup to get ready for testbed
1 parent 69a660d commit 3028865

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

qt/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires = [
77
build-backend = "setuptools.build_meta"
88

99
[project]
10-
dynamic = ["version"]
10+
dynamic = ["version", "dependencies"]
1111
name = "toga-qt"
1212
description = "An Qt (KDE) backend for the Toga widget toolkit."
1313
readme = "README.rst"

testbed/src/testbed/app.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import importlib
2-
import importlib.util
3-
import sys
41
from unittest.mock import Mock
52

63
import toga
7-
from toga.platform import current_platform
84

95

106
class ExampleDoc(toga.Document):
@@ -63,16 +59,6 @@ def task_factory(loop, coro, **kwargs):
6359

6460
self.loop.set_task_factory(task_factory)
6561

66-
# Toga's Qt backend is packaged the same as GTK Linux; substitute
67-
# the Qt backend tests if running on Qt.
68-
if current_platform == "linux-qt":
69-
spec = importlib.util.find_spec("tests_backend_qt")
70-
if spec is None:
71-
raise FileNotFoundError("Could not find Qt backend tests")
72-
qt_module = importlib.import_module("tests_backend_qt")
73-
74-
sys.modules["tests_backend"] = qt_module
75-
7662
# Set a default return code for the app, so that a value is
7763
# available if the app exits for a reason other than the test
7864
# suite exiting/crashing.

testbed/tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import asyncio
22
import gc
3+
import importlib
4+
import importlib.util
35
import inspect
6+
import sys
47
from dataclasses import dataclass
58
from importlib import import_module
69

@@ -9,6 +12,7 @@
912
import toga
1013
from toga.colors import GOLDENROD
1114
from toga.constants import WindowState
15+
from toga.platform import current_platform
1216
from toga.style import Pack
1317

1418
# Ideally, we'd register rewrites for "tests" and get all the submodules
@@ -17,6 +21,16 @@
1721
register_assert_rewrite("tests.widgets")
1822
register_assert_rewrite("tests_backend")
1923

24+
# Toga's Qt backend is packaged the same as GTK Linux; substitute
25+
# the Qt backend tests if running on Qt.
26+
if current_platform == "linux-qt":
27+
spec = importlib.util.find_spec("tests_backend_qt")
28+
if spec is None:
29+
raise FileNotFoundError("Could not find Qt backend tests")
30+
qt_module = importlib.import_module("tests_backend_qt")
31+
32+
sys.modules["tests_backend"] = qt_module
33+
2034

2135
# Use this for widgets or tests which are not supported on some platforms,
2236
# but could be supported in the future.

0 commit comments

Comments
 (0)