Skip to content

Commit 2465edf

Browse files
committed
Add customized app path testing to testbed.
No backends implement it yet.
1 parent 5eda62b commit 2465edf

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

android/tests_backend/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ def get_app_context(self):
2525
return self.native.getApplicationContext()
2626

2727
@contextmanager
28-
def prepare_paths(self):
28+
def prepare_paths(self, *, custom):
29+
if custom:
30+
pytest.xfail("This backend doesn't implement app path customization.")
31+
2932
yield {
3033
"config": Path(self.get_app_context().getFilesDir().getPath()) / "config",
3134
"data": Path(self.get_app_context().getFilesDir().getPath()) / "data",

cocoa/tests_backend/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
import PIL.Image
5+
import pytest
56
from rubicon.objc import SEL, NSPoint, ObjCClass, objc_id, send_message
67

78
import toga
@@ -41,7 +42,10 @@ def is_cursor_visible(self):
4142
return self.app._impl._cursor_visible
4243

4344
@contextmanager
44-
def prepare_paths(self):
45+
def prepare_paths(self, *, custom):
46+
if custom:
47+
pytest.xfail("This backend doesn't implement app path customization.")
48+
4549
yield {
4650
"config": Path.home() / "Library/Preferences/org.beeware.toga.testbed",
4751
"data": Path.home()

gtk/tests_backend/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def is_cursor_visible(self):
3030
pytest.skip("Cursor visibility not implemented on GTK")
3131

3232
@contextmanager
33-
def prepare_paths(self):
33+
def prepare_paths(self, *, custom):
34+
if custom:
35+
pytest.xfail("This backend doesn't implement app path customization.")
36+
3437
yield {
3538
"config": Path.home() / ".config/testbed",
3639
"data": Path.home() / ".local/share/testbed",

iOS/tests_backend/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def get_path(self, search_path):
3131
return Path(urls[0].path)
3232

3333
@contextmanager
34-
def prepare_paths(self):
34+
def prepare_paths(self, *, custom):
35+
if custom:
36+
pytest.xfail("This backend doesn't implement app path customization.")
37+
3538
yield {
3639
"config": self.get_path(NSSearchPathDirectory.ApplicationSupport)
3740
/ "Config",

testbed/tests/test_paths.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66

77
@pytest.mark.parametrize("attr", ["config", "data", "cache", "logs"])
8-
async def test_app_paths(app, app_probe, attr):
9-
with app_probe.prepare_paths() as expected_paths:
8+
@pytest.mark.parametrize("custom", [False, True])
9+
async def test_app_paths(app, app_probe, attr, custom):
10+
with app_probe.prepare_paths(custom=custom) as expected_paths:
1011
"""Platform paths are as expected."""
1112
path = getattr(app.paths, attr)
1213
assert path == expected_paths[attr]

winforms/tests_backend/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ class CURSORINFO(ctypes.Structure):
7272
return info.hCursor is not None
7373

7474
@contextmanager
75-
def prepare_paths(self):
75+
def prepare_paths(self, *, custom):
76+
if custom:
77+
pytest.xfail("This backend doesn't implement app path customization.")
78+
7679
yield {
7780
"config": (
7881
Path.home()

0 commit comments

Comments
 (0)