@@ -24,7 +24,19 @@ 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- def paths (self ):
27+ @property
28+ def _custom_path_root (self ):
29+ return Path .home () / ".cache/testbed/custom_app_paths"
30+
31+ def paths (self , * , custom ):
32+ if custom :
33+ return {
34+ "config" : self ._custom_path_root / "config/testbed" ,
35+ "data" : self ._custom_path_root / "data/testbed" ,
36+ "cache" : self ._custom_path_root / "cache/testbed" ,
37+ "logs" : self ._custom_path_root / "state/testbed/log" ,
38+ }
39+
2840 return {
2941 "config" : Path .home () / ".config/testbed" ,
3042 "data" : Path .home () / ".local/share/testbed" ,
@@ -36,6 +48,19 @@ def paths(self):
3648 def is_cursor_visible (self ):
3749 pytest .skip ("Cursor visibility not implemented on GTK" )
3850
51+ def apply_path_customization (self ):
52+ root = Path .home () / ".cache/testbed/custom_app_paths"
53+ os .environ ["XDG_CONFIG_HOME" ] = str (root / "config" )
54+ os .environ ["XDG_DATA_HOME" ] = str (root / "data" )
55+ os .environ ["XDG_CACHE_HOME" ] = str (root / "cache" )
56+ os .environ ["XDG_STATE_HOME" ] = str (root / "state" )
57+
58+ def remove_path_customization (self ):
59+ del os .environ ["XDG_CONFIG_HOME" ]
60+ del os .environ ["XDG_DATA_HOME" ]
61+ del os .environ ["XDG_CACHE_HOME" ]
62+ del os .environ ["XDG_STATE_HOME" ]
63+
3964 def unhide (self ):
4065 pytest .xfail ("This platform doesn't have an app level unhide." )
4166
0 commit comments