@@ -143,17 +143,16 @@ def test_xdg_variable_custom_value(monkeypatch: pytest.MonkeyPatch, dirs_instanc
143143
144144
145145@pytest .mark .usefixtures ("_getuid" )
146- def test_platform_on_bsd (monkeypatch : pytest .MonkeyPatch , mocker : MockerFixture ) -> None :
146+ @pytest .mark .parametrize ("platform" , ["freebsd" , "openbsd" , "netbsd" ])
147+ def test_platform_on_bsd (monkeypatch : pytest .MonkeyPatch , mocker : MockerFixture , platform : str ) -> None :
147148 monkeypatch .delenv ("XDG_RUNTIME_DIR" , raising = False )
148- mocker .patch ("sys.platform" , "freebsd" )
149- expected_path = "/var/run/user/1234"
150- assert Unix ().user_runtime_dir == expected_path
149+ mocker .patch ("sys.platform" , platform )
151150
152- mocker .patch ("sys.platform " , "openbsd" )
153- assert Unix ().user_runtime_dir == expected_path
151+ mocker .patch ("pathlib.Path.exists " , return_value = True )
152+ assert Unix ().user_runtime_dir == "/var/run/user/1234"
154153
155- mocker .patch ("sys.platform " , "netbsd" )
156- assert Unix ().user_runtime_dir == expected_path
154+ mocker .patch ("pathlib.Path.exists " , return_value = False )
155+ assert Unix ().user_runtime_dir == "/tmp/runtime-1234" # noqa: S108
157156
158157
159158def test_platform_on_win32 (monkeypatch : pytest .MonkeyPatch , mocker : MockerFixture ) -> None :
0 commit comments