File tree Expand file tree Collapse file tree 6 files changed +53
-90
lines changed
Expand file tree Collapse file tree 6 files changed +53
-90
lines changed Original file line number Diff line number Diff line change @@ -23,21 +23,13 @@ def __init__(self, app):
2323 def get_app_context (self ):
2424 return self .native .getApplicationContext ()
2525
26- @property
27- def config_path (self ):
28- return Path (self .get_app_context ().getFilesDir ().getPath ()) / "config"
29-
30- @property
31- def data_path (self ):
32- return Path (self .get_app_context ().getFilesDir ().getPath ()) / "data"
33-
34- @property
35- def cache_path (self ):
36- return Path (self .get_app_context ().getCacheDir ().getPath ())
37-
38- @property
39- def logs_path (self ):
40- return Path (self .get_app_context ().getFilesDir ().getPath ()) / "log"
26+ def paths (self ):
27+ return {
28+ "config" : Path (self .get_app_context ().getFilesDir ().getPath ()) / "config" ,
29+ "data" : Path (self .get_app_context ().getFilesDir ().getPath ()) / "data" ,
30+ "cache" : Path (self .get_app_context ().getCacheDir ().getPath ()),
31+ "logs" : Path (self .get_app_context ().getFilesDir ().getPath ()) / "log" ,
32+ }
4133
4234 def assert_app_icon (self , icon ):
4335 pytest .xfail ("Android apps don't have app icons at runtime" )
Original file line number Diff line number Diff line change @@ -33,21 +33,14 @@ def __init__(self, app):
3333 NSWindow .allowsAutomaticWindowTabbing = False
3434 assert isinstance (self .app ._impl .native , NSApplication )
3535
36- @property
37- def config_path (self ):
38- return Path .home () / "Library/Preferences/org.beeware.toga.testbed"
39-
40- @property
41- def data_path (self ):
42- return Path .home () / "Library/Application Support/org.beeware.toga.testbed"
43-
44- @property
45- def cache_path (self ):
46- return Path .home () / "Library/Caches/org.beeware.toga.testbed"
47-
48- @property
49- def logs_path (self ):
50- return Path .home () / "Library/Logs/org.beeware.toga.testbed"
36+ def paths (self ):
37+ return {
38+ "config" : Path .home () / "Library/Preferences/org.beeware.toga.testbed" ,
39+ "data" : Path .home ()
40+ / "Library/Application Support/org.beeware.toga.testbed" ,
41+ "cache" : Path .home () / "Library/Caches/org.beeware.toga.testbed" ,
42+ "logs" : Path .home () / "Library/Logs/org.beeware.toga.testbed" ,
43+ }
5144
5245 @property
5346 def is_cursor_visible (self ):
Original file line number Diff line number Diff line change @@ -24,21 +24,13 @@ def __init__(self, app):
2424 assert isinstance (self .app ._impl .native , Gtk .Application )
2525 assert IS_WAYLAND is (os .environ .get ("WAYLAND_DISPLAY" , "" ) != "" )
2626
27- @property
28- def config_path (self ):
29- return Path .home () / ".config/testbed"
30-
31- @property
32- def data_path (self ):
33- return Path .home () / ".local/share/testbed"
34-
35- @property
36- def cache_path (self ):
37- return Path .home () / ".cache/testbed"
38-
39- @property
40- def logs_path (self ):
41- return Path .home () / ".local/state/testbed/log"
27+ def paths (self ):
28+ return {
29+ "config" : Path .home () / ".config/testbed" ,
30+ "data" : Path .home () / ".local/share/testbed" ,
31+ "cache" : Path .home () / ".cache/testbed" ,
32+ "logs" : Path .home () / ".local/state/testbed/log" ,
33+ }
4234
4335 @property
4436 def is_cursor_visible (self ):
Original file line number Diff line number Diff line change @@ -29,21 +29,14 @@ def get_path(self, search_path):
2929 )
3030 return Path (urls [0 ].path )
3131
32- @property
33- def config_path (self ):
34- return self .get_path (NSSearchPathDirectory .ApplicationSupport ) / "Config"
35-
36- @property
37- def data_path (self ):
38- return self .get_path (NSSearchPathDirectory .Documents )
39-
40- @property
41- def cache_path (self ):
42- return self .get_path (NSSearchPathDirectory .Cache )
43-
44- @property
45- def logs_path (self ):
46- return self .get_path (NSSearchPathDirectory .ApplicationSupport ) / "Logs"
32+ def paths (self ):
33+ return {
34+ "config" : self .get_path (NSSearchPathDirectory .ApplicationSupport )
35+ / "Config" ,
36+ "data" : self .get_path (NSSearchPathDirectory .Documents ),
37+ "cache" : self .get_path (NSSearchPathDirectory .Cache ),
38+ "logs" : self .get_path (NSSearchPathDirectory .ApplicationSupport ) / "Logs" ,
39+ }
4740
4841 def assert_app_icon (self , icon ):
4942 pytest .xfail ("iOS apps don't have app icons at runtime" )
Original file line number Diff line number Diff line change 88async def test_app_paths (app , app_probe , attr ):
99 """Platform paths are as expected."""
1010 path = getattr (app .paths , attr )
11- assert path == getattr (app_probe , f"{ attr } _path" )
11+ expected_paths = app_probe .paths ()
12+ assert path == expected_paths [attr ]
1213
1314 try :
1415 # We can create a folder in the app path
Original file line number Diff line number Diff line change @@ -27,35 +27,27 @@ def __init__(self, app):
2727 # The Winforms Application class is a singleton instance
2828 assert self .app ._impl .native == Application
2929
30- @property
31- def config_path (self ):
32- return (
33- Path .home ()
34- / "AppData"
35- / "Local"
36- / "Tiberius Yak"
37- / "Toga Testbed"
38- / "Config"
39- )
40-
41- @property
42- def data_path (self ):
43- return Path .home () / "AppData/Local/Tiberius Yak/Toga Testbed/Data"
44-
45- @property
46- def cache_path (self ):
47- return (
48- Path .home ()
49- / "AppData"
50- / "Local"
51- / "Tiberius Yak"
52- / "Toga Testbed"
53- / "Cache"
54- )
55-
56- @property
57- def logs_path (self ):
58- return Path .home () / "AppData/Local/Tiberius Yak/Toga Testbed/Logs"
30+ def paths (self ):
31+ return {
32+ "config" : (
33+ Path .home ()
34+ / "AppData"
35+ / "Local"
36+ / "Tiberius Yak"
37+ / "Toga Testbed"
38+ / "Config"
39+ ),
40+ "data" : Path .home () / "AppData/Local/Tiberius Yak/Toga Testbed/Data" ,
41+ "cache" : (
42+ Path .home ()
43+ / "AppData"
44+ / "Local"
45+ / "Tiberius Yak"
46+ / "Toga Testbed"
47+ / "Cache"
48+ ),
49+ "logs" : Path .home () / "AppData/Local/Tiberius Yak/Toga Testbed/Logs" ,
50+ }
5951
6052 @property
6153 def is_cursor_visible (self ):
You can’t perform that action at this time.
0 commit comments