From 7616bce6082c162e8ec82b6a94c51641cf1ded3b Mon Sep 17 00:00:00 2001 From: phamour Date: Wed, 30 Apr 2025 16:53:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`launch`=20to=20pass?= =?UTF-8?q?=20wait=20and=20locate=20parameters=20to=20`click.launch`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typer/main.py b/typer/main.py index 508d96617e..1987df3dad 100644 --- a/typer/main.py +++ b/typer/main.py @@ -1136,4 +1136,4 @@ def launch(url: str, wait: bool = False, locate: bool = False) -> int: return 0 else: - return click.launch(url) + return click.launch(url, wait=wait, locate=locate) From b0ef9dd0f7a75b461d534d4243d1d6b625820a23 Mon Sep 17 00:00:00 2001 From: phamour Date: Wed, 30 Apr 2025 17:18:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20&=20add=20test=20cases?= =?UTF-8?q?=20for=20`typer.launch`=20to=20include=20wait=20and=20locate=20?= =?UTF-8?q?parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_launch.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_launch.py b/tests/test_launch.py index 75aaa2f091..eeb11f0e05 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -48,4 +48,11 @@ def test_calls_original_launch_when_not_passing_urls(): with patch("typer.main.click.launch", return_value=0) as launch_mock: typer.launch("not a url") - launch_mock.assert_called_once_with("not a url") + launch_mock.assert_called_once_with("not a url", wait=False, locate=False) + + +def test_launch_locating_file(): + with patch("typer.main.click.launch", return_value=0) as launch_mock: + typer.launch("/path/to/file", locate=True) + + launch_mock.assert_called_once_with("/path/to/file", wait=False, locate=True)