@@ -69,6 +69,7 @@ def setUp(self):
69
69
"STEAM_COMPAT_MEDIA_PATH" : "" ,
70
70
"STEAM_FOSSILIZE_DUMP_PATH" : "" ,
71
71
"DXVK_STATE_CACHE_PATH" : "" ,
72
+ "UMU_NO_PROTON" : "" ,
72
73
}
73
74
self .user = getpwuid (os .getuid ()).pw_name
74
75
self .test_opts = "-foo -bar"
@@ -2914,6 +2915,26 @@ def test_setup_pfx_paths(self):
2914
2915
"Expected tracked_files to be a file" ,
2915
2916
)
2916
2917
2918
+ def test_setup_pfx_noproton (self ):
2919
+ """Test setup_pfx when configured to not use Proton."""
2920
+ result = None
2921
+ os .environ ["UMU_NO_PROTON" ] = "1"
2922
+
2923
+ result = umu_run .setup_pfx (self .test_file )
2924
+ self .assertTrue (result is None , f"Expected None, received { result } " )
2925
+ self .assertFalse (
2926
+ Path (self .test_file , "pfx" ).exists (),
2927
+ f"Expected { self .test_file } /pfx to not exist" ,
2928
+ )
2929
+ self .assertFalse (
2930
+ Path (self .test_file , "tracked_files" ).exists (),
2931
+ f"Expected { self .test_file } /tracked_files to not exist" ,
2932
+ )
2933
+ self .assertFalse (
2934
+ Path (self .test_file , "drive_c" ).exists (),
2935
+ f"Expected { self .test_file } /drive_c to not exist" ,
2936
+ )
2937
+
2917
2938
def test_setup_pfx (self ):
2918
2939
"""Test setup_pfx."""
2919
2940
result = None
@@ -3034,6 +3055,62 @@ def test_parse_args_config(self):
3034
3055
result , Namespace , "Expected a Namespace from parse_arg"
3035
3056
)
3036
3057
3058
+ def test_env_nowine_noproton (self ):
3059
+ """Test check_env when configured to not use Proton.
3060
+
3061
+ Expects the directory $HOME/Games/umu/$GAMEID to not be created
3062
+ when UMU_NO_PROTON=1 and GAMEID is set in the host environment.
3063
+ """
3064
+ result = None
3065
+ # Mock $HOME
3066
+ mock_home = Path (self .test_file )
3067
+
3068
+ with (
3069
+ ThreadPoolExecutor () as thread_pool ,
3070
+ # Mock the internal call to Path.home(). Otherwise, some of our
3071
+ # assertions may fail when running this test suite locally if
3072
+ # the user already has that dir
3073
+ patch .object (Path , "home" , return_value = mock_home ),
3074
+ ):
3075
+ os .environ ["UMU_NO_PROTON" ] = "1"
3076
+ os .environ ["GAMEID" ] = "foo"
3077
+ result = umu_run .check_env (self .env , thread_pool )
3078
+ self .assertTrue (result is self .env )
3079
+ path = mock_home .joinpath ("Games" , "umu" , os .environ ["GAMEID" ])
3080
+ # Ensure we did not create the target nor its parents up to $HOME
3081
+ self .assertFalse (path .exists (), f"Expected { path } to not exist" )
3082
+ self .assertFalse (
3083
+ path .parent .exists (), f"Expected { path .parent } to not exist"
3084
+ )
3085
+ self .assertFalse (
3086
+ path .parent .parent .exists (),
3087
+ f"Expected { path .parent .parent } to not exist" ,
3088
+ )
3089
+ self .assertTrue (
3090
+ mock_home .exists (), f"Expected { mock_home } to exist"
3091
+ )
3092
+
3093
+ def test_env_wine_noproton (self ):
3094
+ """Test check_env when configured to not use Proton.
3095
+
3096
+ Expects the WINE prefix directory to not be created when
3097
+ UMU_NO_PROTON=1 and WINEPREFIX is set in the host environment.
3098
+ """
3099
+ result = None
3100
+
3101
+ with (
3102
+ ThreadPoolExecutor () as thread_pool ,
3103
+ ):
3104
+ os .environ ["WINEPREFIX" ] = "123"
3105
+ os .environ ["UMU_NO_PROTON" ] = "1"
3106
+ os .environ ["GAMEID" ] = "foo"
3107
+ result = umu_run .check_env (self .env , thread_pool )
3108
+ self .assertTrue (result is self .env )
3109
+ self .assertFalse (
3110
+ Path (os .environ ["WINEPREFIX" ]).exists (),
3111
+ f"Expected directory { os .environ ['WINEPREFIX' ]} to not exist" ,
3112
+ )
3113
+
3037
3114
def test_env_proton_nodir (self ):
3038
3115
"""Test check_env when $PROTONPATH in the case we failed to set it.
3039
3116
0 commit comments