88
99
1010@pytest .mark .parametrize (
11- "system, command" ,
11+ "system, sys_platform, command" ,
1212 [
13- ("Darwin" , "open" ),
14- ("Linux" , "xdg-open" ),
15- ("FreeBSD" , "xdg-open" ),
13+ ("Darwin" , "darwin" , " open" ),
14+ ("Linux" , "linux" , " xdg-open" ),
15+ ("FreeBSD" , "freebsd8" , " xdg-open" ),
1616 ],
1717)
18- def test_launch_url_unix (system : str , command : str ):
18+ def test_launch_url_unix (system : str , sys_platform : str , command : str ):
1919 with patch ("platform.system" , return_value = system ), patch (
20- "shutil.which" , return_value = True
21- ), patch ("subprocess.Popen" ) as mock_popen :
20+ "sys.platform" , sys_platform
21+ ), patch ("shutil.which" , return_value = True ), patch (
22+ "subprocess.Popen"
23+ ) as mock_popen :
2224 typer .launch (url )
2325
2426 mock_popen .assert_called_once_with (
@@ -27,7 +29,7 @@ def test_launch_url_unix(system: str, command: str):
2729
2830
2931def test_launch_url_windows ():
30- with patch ("platform.system " , return_value = "Windows " ), patch (
32+ with patch ("sys.platform " , "windows " ), patch (
3133 "webbrowser.open"
3234 ) as mock_webbrowser_open :
3335 typer .launch (url )
0 commit comments