diff --git a/python-typer-rpmlintrc b/python-typer-rpmlintrc deleted file mode 100644 index c841f7a..0000000 --- a/python-typer-rpmlintrc +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file required for conformity with PEP-561 -addFilter("zero-length /usr/lib/python3.6/site-packages/typer/py.typed") diff --git a/python-typer.changes b/python-typer.changes index 1cf1590..5d9f89e 100644 --- a/python-typer.changes +++ b/python-typer.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Fri Jun 24 18:20:30 UTC 2022 - Matthias Bach - 0.4.1 + +- Add run-subprocesses-with-correct-python.patch to ensure tests + aren't accidentally running subprocesses using the wrong Python + version. +- Add set-proper-pythonpath-for-tutorial-script-tests.patch to fix + issue with build failing due to import failures. + +------------------------------------------------------------------- +Tue Jun 14 14:37:26 UTC 2022 - Matthias Bach - 0.4.1 + +- Update to upstream version 0.4.1 + * Fix import of get_terminal_size for Click 8.1.0 support. +- Switch from traditional setup.py installation to pyproject macros + as upstream no longer ships its setup.py compability wrapper. + ------------------------------------------------------------------- Mon Aug 30 19:31:17 UTC 2021 - Matthias Bach - 0.4.0 diff --git a/python-typer.spec b/python-typer.spec index 5667b5f..c7c45ba 100644 --- a/python-typer.spec +++ b/python-typer.spec @@ -1,7 +1,7 @@ # # spec file for package python-typer # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2021 Matthias Bach # # All modifications and additions to the file contributed by third parties @@ -19,17 +19,19 @@ %define skip_python2 1 Name: python-typer -Version: 0.4.0 +Version: 0.4.1 Release: 0 Summary: Typer, build great CLIs. Easy to code. Based on Python type hints License: MIT Group: Development/Languages/Python URL: https://github.com/tiangolo/typer Source: https://files.pythonhosted.org/packages/source/t/typer/typer-%{version}.tar.gz -Source1: %{name}-rpmlintrc +Patch0: run-subprocesses-with-correct-python.patch +Patch1: set-proper-pythonpath-for-tutorial-script-tests.patch BuildRequires: %{python_module click} BuildRequires: %{python_module coverage} BuildRequires: %{python_module flit-core} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module shellingham} BuildRequires: fdupes @@ -50,12 +52,13 @@ This package provides the Typer Python package required to build and run Typer-b %prep %setup -q -n typer-%{version} +%autopatch -p1 %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check diff --git a/run-subprocesses-with-correct-python.patch b/run-subprocesses-with-correct-python.patch new file mode 100644 index 0000000..3db6e23 --- /dev/null +++ b/run-subprocesses-with-correct-python.patch @@ -0,0 +1,2786 @@ +From: Matthias Bach +Date: Fri, 24 Jun 2022 08:45:31 +0200 +Subject: [PATCH] Consistently use sys.executable to run subprocesses +References: https://github.com/tiangolo/typer/pull/408 +Upstream: sent + +In some scenarios, like running pytest outside of an active virtualenv, +it could happen that "coverage" would refer to a different Python +interpreter than the one running the tests. Admittedly that does not +happen in standard development scenarios where you use a virtualenv. But +it easily happens when packaging for Linux distributions that support +multiple versions of Python and it can also happen when running pytest +from a virtualenv without activating it. The latter is something that's +convenient when testing versus multiple Python versions without using +tox. + +Explicitly invoking coverage as a module on sys.executable ensures that +the same binary, not process, that's also running the tests is used. +This was in fact already done in some tests but not consistently across +all of them. +--- + tests/test_compat/test_option_get_help.py | 3 +- + tests/test_completion/test_completion.py | 16 +++--- + .../test_completion_complete.py | 21 ++++---- + .../test_completion_complete_no_help.py | 9 ++-- + .../test_completion_install.py | 33 ++++++++++-- + tests/test_completion/test_completion_show.py | 53 ++++++++++++++++--- + tests/test_others.py | 9 ++-- + tests/test_prog_name.py | 3 +- + .../test_default/test_tutorial001.py | 3 +- + .../test_default/test_tutorial002.py | 3 +- + .../test_envvar/test_tutorial001.py | 3 +- + .../test_envvar/test_tutorial002.py | 3 +- + .../test_envvar/test_tutorial003.py | 3 +- + .../test_help/test_tutorial001.py | 3 +- + .../test_help/test_tutorial002.py | 3 +- + .../test_help/test_tutorial003.py | 3 +- + .../test_help/test_tutorial004.py | 3 +- + .../test_help/test_tutorial005.py | 3 +- + .../test_help/test_tutorial006.py | 3 +- + .../test_help/test_tutorial007.py | 3 +- + .../test_optional/test_tutorial001.py | 3 +- + .../test_optional/test_tutorial002.py | 3 +- + .../test_arguments/test_tutorial001.py | 3 +- + .../test_callback/test_tutorial001.py | 3 +- + .../test_callback/test_tutorial002.py | 3 +- + .../test_callback/test_tutorial003.py | 3 +- + .../test_callback/test_tutorial004.py | 3 +- + .../test_context/test_tutorial001.py | 3 +- + .../test_context/test_tutorial002.py | 3 +- + .../test_context/test_tutorial003.py | 3 +- + .../test_context/test_tutorial004.py | 3 +- + .../test_help/test_tutorial001.py | 3 +- + .../test_help/test_tutorial002.py | 3 +- + .../test_index/test_tutorial001.py | 3 +- + .../test_index/test_tutorial002.py | 3 +- + .../test_name/test_tutorial001.py | 3 +- + .../test_one_or_multiple/test_tutorial001.py | 3 +- + .../test_one_or_multiple/test_tutorial002.py | 3 +- + .../test_options/test_tutorial001.py | 3 +- + .../test_first_steps/test_tutorial001.py | 3 +- + .../test_first_steps/test_tutorial002.py | 3 +- + .../test_first_steps/test_tutorial003.py | 3 +- + .../test_first_steps/test_tutorial004.py | 3 +- + .../test_first_steps/test_tutorial005.py | 3 +- + .../test_first_steps/test_tutorial006.py | 3 +- + .../test_tutorial001.py | 3 +- + .../test_tutorial002.py | 3 +- + .../test_multiple_options/test_tutorial001.py | 3 +- + .../test_multiple_options/test_tutorial002.py | 3 +- + .../test_tutorial001.py | 3 +- + .../test_callback/test_tutorial001.py | 3 +- + .../test_callback/test_tutorial003.py | 5 +- + .../test_callback/test_tutorial004.py | 5 +- + .../test_completion/test_tutorial002.py | 5 +- + .../test_completion/test_tutorial003.py | 5 +- + .../test_completion/test_tutorial004.py | 5 +- + .../test_completion/test_tutorial007.py | 5 +- + .../test_completion/test_tutorial008.py | 5 +- + .../test_completion/test_tutorial009.py | 5 +- + .../test_help/test_tutorial001.py | 3 +- + .../test_help/test_tutorial002.py | 3 +- + .../test_name/test_tutorial001.py | 3 +- + .../test_name/test_tutorial002.py | 3 +- + .../test_name/test_tutorial003.py | 3 +- + .../test_name/test_tutorial004.py | 3 +- + .../test_name/test_tutorial005.py | 3 +- + .../test_prompt/test_tutorial001.py | 3 +- + .../test_prompt/test_tutorial002.py | 3 +- + .../test_prompt/test_tutorial003.py | 3 +- + .../test_required/test_tutorial002.py | 3 +- + .../test_version/test_tutorial003.py | 5 +- + .../test_bool/test_tutorial001.py | 3 +- + .../test_bool/test_tutorial002.py | 3 +- + .../test_bool/test_tutorial003.py | 3 +- + .../test_bool/test_tutorial004.py | 3 +- + .../test_datetime/test_tutorial001.py | 3 +- + .../test_datetime/test_tutorial002.py | 3 +- + .../test_enum/test_tutorial001.py | 3 +- + .../test_enum/test_tutorial002.py | 3 +- + .../test_file/test_tutorial001.py | 3 +- + .../test_file/test_tutorial002.py | 3 +- + .../test_file/test_tutorial003.py | 3 +- + .../test_file/test_tutorial004.py | 3 +- + .../test_file/test_tutorial005.py | 3 +- + .../test_index/test_tutorial001.py | 3 +- + .../test_number/test_tutorial001.py | 3 +- + .../test_number/test_tutorial002.py | 3 +- + .../test_number/test_tutorial003.py | 3 +- + .../test_path/test_tutorial001.py | 3 +- + .../test_path/test_tutorial002.py | 3 +- + .../test_uuid/test_tutorial001.py | 3 +- + .../test_prompt/test_tutorial001.py | 3 +- + .../test_prompt/test_tutorial002.py | 3 +- + .../test_prompt/test_tutorial003.py | 3 +- + .../test_tutorial001.py | 3 +- + .../test_tutorial002.py | 3 +- + .../test_tutorial003.py | 3 +- + .../test_tutorial004.py | 3 +- + .../test_name_help/test_tutorial001.py | 3 +- + .../test_name_help/test_tutorial002.py | 3 +- + .../test_name_help/test_tutorial003.py | 3 +- + .../test_name_help/test_tutorial004.py | 3 +- + .../test_name_help/test_tutorial005.py | 3 +- + .../test_name_help/test_tutorial006.py | 3 +- + .../test_name_help/test_tutorial007.py | 3 +- + .../test_name_help/test_tutorial008.py | 3 +- + .../test_subcommands/test_tutorial001.py | 3 +- + .../test_subcommands/test_tutorial002.py | 3 +- + .../test_subcommands/test_tutorial003.py | 3 +- + .../test_terminating/test_tutorial001.py | 3 +- + .../test_terminating/test_tutorial002.py | 3 +- + .../test_terminating/test_tutorial003.py | 3 +- + .../test_tutorial/test_testing/test_app01.py | 3 +- + .../test_tutorial/test_testing/test_app02.py | 3 +- + .../test_tutorial/test_testing/test_app03.py | 3 +- + .../test_using_click/test_tutorial003.py | 3 +- + .../test_using_click/test_tutorial004.py | 3 +- + 117 files changed, 336 insertions(+), 156 deletions(-) + +diff --git a/tests/test_compat/test_option_get_help.py b/tests/test_compat/test_option_get_help.py +index e8e1eac..60ae5fe 100644 +--- a/tests/test_compat/test_option_get_help.py ++++ b/tests/test_compat/test_option_get_help.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -26,7 +27,7 @@ def test_coverage_call(): + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_completion/test_completion.py b/tests/test_completion/test_completion.py +index d7ec6d3..62265dd 100644 +--- a/tests/test_completion/test_completion.py ++++ b/tests/test_completion/test_completion.py +@@ -47,7 +47,7 @@ def test_install_completion(): + + def test_completion_invalid_instruction(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -63,7 +63,7 @@ def test_completion_invalid_instruction(): + + def test_completion_source_bash(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -81,7 +81,7 @@ def test_completion_source_bash(): + + def test_completion_source_invalid_shell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -96,7 +96,7 @@ def test_completion_source_invalid_shell(): + + def test_completion_source_invalid_instruction(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -111,7 +111,7 @@ def test_completion_source_invalid_instruction(): + + def test_completion_source_zsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -126,7 +126,7 @@ def test_completion_source_zsh(): + + def test_completion_source_fish(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -141,7 +141,7 @@ def test_completion_source_fish(): + + def test_completion_source_powershell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -159,7 +159,7 @@ def test_completion_source_powershell(): + + def test_completion_source_pwsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__], ++ [sys.executable, "-m", "coverage", "run", mod.__file__], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_completion/test_completion_complete.py b/tests/test_completion/test_completion_complete.py +index e4f8b7e..e3fbb31 100644 +--- a/tests/test_completion/test_completion_complete.py ++++ b/tests/test_completion/test_completion_complete.py +@@ -1,12 +1,13 @@ + import os + import subprocess ++import sys + + from docs_src.commands.help import tutorial001 as mod + + + def test_completion_complete_subcommand_bash(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -23,7 +24,7 @@ def test_completion_complete_subcommand_bash(): + + def test_completion_complete_subcommand_bash_invalid(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -40,7 +41,7 @@ def test_completion_complete_subcommand_bash_invalid(): + + def test_completion_complete_subcommand_zsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -59,7 +60,7 @@ def test_completion_complete_subcommand_zsh(): + + def test_completion_complete_subcommand_zsh_files(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -75,7 +76,7 @@ def test_completion_complete_subcommand_zsh_files(): + + def test_completion_complete_subcommand_fish(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -95,7 +96,7 @@ def test_completion_complete_subcommand_fish(): + + def test_completion_complete_subcommand_fish_should_complete(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -112,7 +113,7 @@ def test_completion_complete_subcommand_fish_should_complete(): + + def test_completion_complete_subcommand_fish_should_complete_no(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -129,7 +130,7 @@ def test_completion_complete_subcommand_fish_should_complete_no(): + + def test_completion_complete_subcommand_powershell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -147,7 +148,7 @@ def test_completion_complete_subcommand_powershell(): + + def test_completion_complete_subcommand_pwsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -165,7 +166,7 @@ def test_completion_complete_subcommand_pwsh(): + + def test_completion_complete_subcommand_noshell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_completion/test_completion_complete_no_help.py b/tests/test_completion/test_completion_complete_no_help.py +index c221b69..bf5762c 100644 +--- a/tests/test_completion/test_completion_complete_no_help.py ++++ b/tests/test_completion/test_completion_complete_no_help.py +@@ -1,12 +1,13 @@ + import os + import subprocess ++import sys + + from docs_src.commands.index import tutorial002 as mod + + + def test_completion_complete_subcommand_zsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -23,7 +24,7 @@ def test_completion_complete_subcommand_zsh(): + + def test_completion_complete_subcommand_fish(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -40,7 +41,7 @@ def test_completion_complete_subcommand_fish(): + + def test_completion_complete_subcommand_powershell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -56,7 +57,7 @@ def test_completion_complete_subcommand_powershell(): + + def test_completion_complete_subcommand_pwsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_completion/test_completion_install.py b/tests/test_completion/test_completion_install.py +index 057bb89..b0027e8 100644 +--- a/tests/test_completion/test_completion_install.py ++++ b/tests/test_completion/test_completion_install.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + from pathlib import Path + from unittest import mock + +@@ -16,7 +17,7 @@ app.command()(mod.main) + + def test_completion_install_no_shell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--install-completion"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--install-completion"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -39,7 +40,15 @@ def test_completion_install_bash(): + if bash_completion_path.is_file(): + text = bash_completion_path.read_text() + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--install-completion", "bash"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--install-completion", ++ "bash", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -74,7 +83,15 @@ def test_completion_install_zsh(): + if completion_path.is_file(): + text = completion_path.read_text() + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--install-completion", "zsh"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--install-completion", ++ "zsh", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -103,7 +120,15 @@ def test_completion_install_fish(): + Path.home() / f".config/fish/completions/{script_path.name}.fish" + ) + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--install-completion", "fish"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--install-completion", ++ "fish", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_completion/test_completion_show.py b/tests/test_completion/test_completion_show.py +index 2efb6d8..6dab1df 100644 +--- a/tests/test_completion/test_completion_show.py ++++ b/tests/test_completion/test_completion_show.py +@@ -1,12 +1,13 @@ + import os + import subprocess ++import sys + + from docs_src.first_steps import tutorial001 as mod + + + def test_completion_show_no_shell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--show-completion"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -25,7 +26,15 @@ def test_completion_show_no_shell(): + + def test_completion_show_bash(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion", "bash"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--show-completion", ++ "bash", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -43,7 +52,15 @@ def test_completion_show_bash(): + + def test_completion_source_zsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion", "zsh"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--show-completion", ++ "zsh", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -58,7 +75,15 @@ def test_completion_source_zsh(): + + def test_completion_source_fish(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion", "fish"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--show-completion", ++ "fish", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -73,7 +98,15 @@ def test_completion_source_fish(): + + def test_completion_source_powershell(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion", "powershell"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--show-completion", ++ "powershell", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -91,7 +124,15 @@ def test_completion_source_powershell(): + + def test_completion_source_pwsh(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--show-completion", "pwsh"], ++ [ ++ sys.executable, ++ "-m", ++ "coverage", ++ "run", ++ mod.__file__, ++ "--show-completion", ++ "pwsh", ++ ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_others.py b/tests/test_others.py +index 2060a86..262e4e3 100644 +--- a/tests/test_others.py ++++ b/tests/test_others.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + from pathlib import Path + from typing import Optional + from unittest import mock +@@ -129,7 +130,7 @@ def test_callback_3_untyped_parameters(): + def test_completion_untyped_parameters(): + file_path = Path(__file__).parent / "assets/completion_no_types.py" + result = subprocess.run( +- ["coverage", "run", str(file_path)], ++ [sys.executable, "-m", "coverage", "run", str(file_path)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -151,7 +152,7 @@ def test_completion_untyped_parameters(): + assert '"Carlos":"The writer of scripts."' in result.stdout + + result = subprocess.run( +- ["coverage", "run", str(file_path)], ++ [sys.executable, "-m", "coverage", "run", str(file_path)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -162,7 +163,7 @@ def test_completion_untyped_parameters(): + def test_completion_untyped_parameters_different_order_correct_names(): + file_path = Path(__file__).parent / "assets/completion_no_types_order.py" + result = subprocess.run( +- ["coverage", "run", str(file_path)], ++ [sys.executable, "-m", "coverage", "run", str(file_path)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -184,7 +185,7 @@ def test_completion_untyped_parameters_different_order_correct_names(): + assert '"Carlos":"The writer of scripts."' in result.stdout + + result = subprocess.run( +- ["coverage", "run", str(file_path)], ++ [sys.executable, "-m", "coverage", "run", str(file_path)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_prog_name.py b/tests/test_prog_name.py +index 06dd8c8..58626c7 100644 +--- a/tests/test_prog_name.py ++++ b/tests/test_prog_name.py +@@ -1,11 +1,12 @@ + import subprocess ++import sys + from pathlib import Path + + + def test_custom_prog_name(): + file_path = Path(__file__).parent / "assets/prog_name.py" + result = subprocess.run( +- ["coverage", "run", str(file_path), "--help"], ++ [sys.executable, "-m", "coverage", "run", str(file_path), "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py b/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py +index 63e8414..fa78495 100644 +--- a/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py ++++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -33,7 +34,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py b/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py +index b78d1c1..5abd249 100644 +--- a/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py ++++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -35,7 +36,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py +index 92ef84f..62214d4 100644 +--- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py ++++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -39,7 +40,7 @@ def test_call_env_var_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py +index f9e23f8..e098a15 100644 +--- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py ++++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -39,7 +40,7 @@ def test_call_env_var2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py +index 3a98fc5..59183f3 100644 +--- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py ++++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -40,7 +41,7 @@ def test_call_env_var_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py +index ad448ce..fd64a89 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -29,7 +30,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py +index 8f2f079..8f8778b 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -30,7 +31,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py +index db6ab45..6a982bf 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -30,7 +31,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py +index 46eb0b3..94c76e8 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -30,7 +31,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py +index 5405b4c..737a5b1 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -28,7 +29,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py +index 89acf99..201dc9d 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -28,7 +29,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py +index 3b86dc2..00f6d96 100644 +--- a/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py ++++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -28,7 +29,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py b/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py +index 0b776bd..bb016f6 100644 +--- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py ++++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py b/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py +index 9a2de95..c616d46 100644 +--- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py ++++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -31,7 +32,7 @@ def test_call_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py b/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py +index a5615a0..f515669 100644 +--- a/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -35,7 +36,7 @@ def test_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py b/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py +index 6d4dc1f..91e68b7 100644 +--- a/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -58,7 +59,7 @@ def test_wrong_verbose(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py b/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py +index 4fd4e1b..d8478d3 100644 +--- a/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py ++++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -18,7 +19,7 @@ def test_app(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py b/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py +index 3f13891..bf0e5f3 100644 +--- a/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py ++++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -23,7 +24,7 @@ def test_for_coverage(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py b/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py +index e2d1d2f..7943228 100644 +--- a/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py ++++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -25,7 +26,7 @@ def test_app(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_context/test_tutorial001.py b/tests/test_tutorial/test_commands/test_context/test_tutorial001.py +index df15d7c..2e3c7b7 100644 +--- a/tests/test_tutorial/test_commands/test_context/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_context/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -25,7 +26,7 @@ def test_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_context/test_tutorial002.py b/tests/test_tutorial/test_commands/test_context/test_tutorial002.py +index 80556fc..6aab364 100644 +--- a/tests/test_tutorial/test_commands/test_context/test_tutorial002.py ++++ b/tests/test_tutorial/test_commands/test_context/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_callback(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_context/test_tutorial003.py b/tests/test_tutorial/test_commands/test_context/test_tutorial003.py +index 3b15d27..6d5b5c3 100644 +--- a/tests/test_tutorial/test_commands/test_context/test_tutorial003.py ++++ b/tests/test_tutorial/test_commands/test_context/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_callback(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_context/test_tutorial004.py b/tests/test_tutorial/test_commands/test_context/test_tutorial004.py +index 3546cc3..8ce5997 100644 +--- a/tests/test_tutorial/test_commands/test_context/test_tutorial004.py ++++ b/tests/test_tutorial/test_commands/test_context/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -20,7 +21,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial001.py b/tests/test_tutorial/test_commands/test_help/test_tutorial001.py +index 232369c..fbca4e7 100644 +--- a/tests/test_tutorial/test_commands/test_help/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_help/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -115,7 +116,7 @@ def test_init(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial002.py b/tests/test_tutorial/test_commands/test_help/test_tutorial002.py +index dcadf53..f53b5fe 100644 +--- a/tests/test_tutorial/test_commands/test_help/test_tutorial002.py ++++ b/tests/test_tutorial/test_commands/test_help/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -48,7 +49,7 @@ def test_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_index/test_tutorial001.py b/tests/test_tutorial/test_commands/test_index/test_tutorial001.py +index 18abc77..b9f40b1 100644 +--- a/tests/test_tutorial/test_commands/test_index/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_index/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -23,7 +24,7 @@ def test_arg(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_index/test_tutorial002.py b/tests/test_tutorial/test_commands/test_index/test_tutorial002.py +index 27421dc..db209aa 100644 +--- a/tests/test_tutorial/test_commands/test_index/test_tutorial002.py ++++ b/tests/test_tutorial/test_commands/test_index/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -32,7 +33,7 @@ def test_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_name/test_tutorial001.py b/tests/test_tutorial/test_commands/test_name/test_tutorial001.py +index f7c44e3..c06aeaf 100644 +--- a/tests/test_tutorial/test_commands/test_name/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_name/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial001.py b/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial001.py +index e6afb1f..d833bbd 100644 +--- a/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -24,7 +25,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial002.py b/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial002.py +index c4ffe59..d4687b9 100644 +--- a/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial002.py ++++ b/tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -26,7 +27,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_commands/test_options/test_tutorial001.py b/tests/test_tutorial/test_commands/test_options/test_tutorial001.py +index 3b8b5ca..1e8ee28 100644 +--- a/tests/test_tutorial/test_commands/test_options/test_tutorial001.py ++++ b/tests/test_tutorial/test_commands/test_options/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -88,7 +89,7 @@ def test_init(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial001.py b/tests/test_tutorial/test_first_steps/test_tutorial001.py +index 8c54385..4a465db 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial001.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -17,7 +18,7 @@ def test_cli(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial002.py b/tests/test_tutorial/test_first_steps/test_tutorial002.py +index fc2026f..d827fc6 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial002.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial003.py b/tests/test_tutorial/test_first_steps/test_tutorial003.py +index a9e57da..05c7e49 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial003.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial004.py b/tests/test_tutorial/test_first_steps/test_tutorial004.py +index 1a3bf3d..76f60dc 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial004.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -46,7 +47,7 @@ def test_formal_3(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial005.py b/tests/test_tutorial/test_first_steps/test_tutorial005.py +index c087b01..d2326ce 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial005.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial005.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -46,7 +47,7 @@ def test_formal_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_first_steps/test_tutorial006.py b/tests/test_tutorial/test_first_steps/test_tutorial006.py +index 560191e..08cafe7 100644 +--- a/tests/test_tutorial/test_first_steps/test_tutorial006.py ++++ b/tests/test_tutorial/test_first_steps/test_tutorial006.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -44,7 +45,7 @@ def test_formal_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py +index d4effbc..315000b 100644 +--- a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py ++++ b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -19,7 +20,7 @@ def test_main(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py +index d97a744..4b19040 100644 +--- a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py ++++ b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -47,7 +48,7 @@ def test_valid_args(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py +index fd0a102..82beb31 100644 +--- a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py ++++ b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -35,7 +36,7 @@ def test_3_user(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py +index 8c4df70..d30357e 100644 +--- a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py ++++ b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -30,7 +31,7 @@ def test_2_number(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py b/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py +index a6862f6..6422bdd 100644 +--- a/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py ++++ b/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -44,7 +45,7 @@ def test_invalid_user(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial001.py b/tests/test_tutorial/test_options/test_callback/test_tutorial001.py +index 71d2dc8..e6a142b 100644 +--- a/tests/test_tutorial/test_options/test_callback/test_tutorial001.py ++++ b/tests/test_tutorial/test_options/test_callback/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial003.py b/tests/test_tutorial/test_options/test_callback/test_tutorial003.py +index d4dac97..3adadf5 100644 +--- a/tests/test_tutorial/test_options/test_callback/test_tutorial003.py ++++ b/tests/test_tutorial/test_options/test_callback/test_tutorial003.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -27,7 +28,7 @@ def test_2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -37,7 +38,7 @@ def test_script(): + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial004.py b/tests/test_tutorial/test_options/test_callback/test_tutorial004.py +index 447c262..d5685d7 100644 +--- a/tests/test_tutorial/test_options/test_callback/test_tutorial004.py ++++ b/tests/test_tutorial/test_options/test_callback/test_tutorial004.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -27,7 +28,7 @@ def test_2(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -37,7 +38,7 @@ def test_script(): + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial002.py b/tests/test_tutorial/test_options/test_completion/test_tutorial002.py +index 593f28b..dc468a5 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial002.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial002.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -38,7 +39,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial003.py b/tests/test_tutorial/test_options/test_completion/test_tutorial003.py +index fccb867..c6be246 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial003.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial003.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -38,7 +39,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial004.py b/tests/test_tutorial/test_options/test_completion/test_tutorial004.py +index 6ae5d9a..b9d3b8a 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial004.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial004.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -38,7 +39,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial007.py b/tests/test_tutorial/test_options/test_completion/test_tutorial007.py +index 0976541..372d963 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial007.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial007.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -39,7 +40,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial008.py b/tests/test_tutorial/test_options/test_completion/test_tutorial008.py +index 597d8f0..87683b7 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial008.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial008.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -41,7 +42,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_completion/test_tutorial009.py b/tests/test_tutorial/test_options/test_completion/test_tutorial009.py +index 8e52908..8c7869a 100644 +--- a/tests/test_tutorial/test_options/test_completion/test_tutorial009.py ++++ b/tests/test_tutorial/test_options/test_completion/test_tutorial009.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -14,7 +15,7 @@ app.command()(mod.main) + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -41,7 +42,7 @@ def test_1(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_help/test_tutorial001.py b/tests/test_tutorial/test_options/test_help/test_tutorial001.py +index f9f7d22..3e89d55 100644 +--- a/tests/test_tutorial/test_options/test_help/test_tutorial001.py ++++ b/tests/test_tutorial/test_options/test_help/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -40,7 +41,7 @@ def test_formal(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_help/test_tutorial002.py b/tests/test_tutorial/test_options/test_help/test_tutorial002.py +index 501d5d2..094f2d4 100644 +--- a/tests/test_tutorial/test_options/test_help/test_tutorial002.py ++++ b/tests/test_tutorial/test_options/test_help/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -26,7 +27,7 @@ def test_help(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial001.py b/tests/test_tutorial/test_options/test_name/test_tutorial001.py +index 4db89bc..c4b2ccc 100644 +--- a/tests/test_tutorial/test_options/test_name/test_tutorial001.py ++++ b/tests/test_tutorial/test_options/test_name/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -26,7 +27,7 @@ def test_call(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial002.py b/tests/test_tutorial/test_options/test_name/test_tutorial002.py +index 0426bc0..1d5683e 100644 +--- a/tests/test_tutorial/test_options/test_name/test_tutorial002.py ++++ b/tests/test_tutorial/test_options/test_name/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -32,7 +33,7 @@ def test_call_long(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial003.py b/tests/test_tutorial/test_options/test_name/test_tutorial003.py +index 98ae253..aa620c7 100644 +--- a/tests/test_tutorial/test_options/test_name/test_tutorial003.py ++++ b/tests/test_tutorial/test_options/test_name/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -27,7 +28,7 @@ def test_call(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial004.py b/tests/test_tutorial/test_options/test_name/test_tutorial004.py +index aa327cc..c6cf1b8 100644 +--- a/tests/test_tutorial/test_options/test_name/test_tutorial004.py ++++ b/tests/test_tutorial/test_options/test_name/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -32,7 +33,7 @@ def test_call_long(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial005.py b/tests/test_tutorial/test_options/test_name/test_tutorial005.py +index 1a372b4..da656b5 100644 +--- a/tests/test_tutorial/test_options/test_name/test_tutorial005.py ++++ b/tests/test_tutorial/test_options/test_name/test_tutorial005.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -43,7 +44,7 @@ def test_call_condensed_wrong_order(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py +index 8292942..bc981af 100644 +--- a/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py ++++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -33,7 +34,7 @@ def test_help(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py +index 89428e5..4d49aad 100644 +--- a/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py ++++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -33,7 +34,7 @@ def test_help(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py +index 7ef29de..358a1c4 100644 +--- a/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py ++++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -47,7 +48,7 @@ def test_help(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_required/test_tutorial002.py b/tests/test_tutorial/test_options/test_required/test_tutorial002.py +index d2e8bbc..c020575 100644 +--- a/tests/test_tutorial/test_options/test_required/test_tutorial002.py ++++ b/tests/test_tutorial/test_options/test_required/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -32,7 +33,7 @@ def test_help(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_options/test_version/test_tutorial003.py b/tests/test_tutorial/test_options/test_version/test_tutorial003.py +index d3f80a9..9112018 100644 +--- a/tests/test_tutorial/test_options/test_version/test_tutorial003.py ++++ b/tests/test_tutorial/test_options/test_version/test_tutorial003.py +@@ -1,5 +1,6 @@ + import os + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -32,7 +33,7 @@ def test_3(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +@@ -42,7 +43,7 @@ def test_script(): + + def test_completion(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, " "], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, " "], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py +index 344d650..2a9d377 100644 +--- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -43,7 +44,7 @@ def test_invalid_no_force(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py +index 098b196..69a8146 100644 +--- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -49,7 +50,7 @@ def test_invalid_no_accept(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py +index 923c6e8..33bdd94 100644 +--- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py ++++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -31,7 +32,7 @@ def test_no_force(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py +index e4e7935..de08f7f 100644 +--- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py ++++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -37,7 +38,7 @@ def test_short_demo(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py +index 60b69ef..7a4b4c9 100644 +--- a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -38,7 +39,7 @@ def test_invalid(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py +index 38ebd3c..ec8fc71 100644 +--- a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_usa_weird_date_format(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py +index 9944da5..0381ab6 100644 +--- a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -38,7 +39,7 @@ def test_invalid(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py +index 51686d0..293a176 100644 +--- a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_mix(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py +index 4357c9f..061266a 100644 +--- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -24,7 +25,7 @@ def test_main(tmpdir): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py +index 5556ccd..bbb7696 100644 +--- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -26,7 +27,7 @@ def test_main(tmpdir): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py +index 1387ca2..ae452d0 100644 +--- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py ++++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -23,7 +24,7 @@ def test_main(tmpdir): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py +index 6ce004d..aa51f39 100644 +--- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py ++++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -27,7 +28,7 @@ def test_main(tmpdir): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py +index 841df52..7f79fd4 100644 +--- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py ++++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -29,7 +30,7 @@ def test_main(tmpdir): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py +index 2e1a300..7ee1652 100644 +--- a/tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -44,7 +45,7 @@ def test_invalid(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py +index 64d2f2a..c8bd4d4 100644 +--- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -76,7 +77,7 @@ def test_negative_score(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py +index c0bc226..1f7fcb8 100644 +--- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -34,7 +35,7 @@ def test_clamped(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py +index 904b8b0..3d0a741 100644 +--- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py ++++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -49,7 +50,7 @@ def test_verbose_short_3_condensed(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py +index 740b92f..2405805 100644 +--- a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -46,7 +47,7 @@ def test_dir(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py +index 6bd48ed..7ec71d8 100644 +--- a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py ++++ b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + from pathlib import Path + + import typer +@@ -42,7 +43,7 @@ def test_dir(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py +index dff3244..280363d 100644 +--- a/tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py ++++ b/tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -33,7 +34,7 @@ def test_invalid_uuid(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_prompt/test_tutorial001.py b/tests/test_tutorial/test_prompt/test_tutorial001.py +index 42cbdfc..00c9061 100644 +--- a/tests/test_tutorial/test_prompt/test_tutorial001.py ++++ b/tests/test_tutorial/test_prompt/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -20,7 +21,7 @@ def test_cli(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_prompt/test_tutorial002.py b/tests/test_tutorial/test_prompt/test_tutorial002.py +index 9ac170e..069bb88 100644 +--- a/tests/test_tutorial/test_prompt/test_tutorial002.py ++++ b/tests/test_tutorial/test_prompt/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -28,7 +29,7 @@ def test_no_confirm(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_prompt/test_tutorial003.py b/tests/test_tutorial/test_prompt/test_tutorial003.py +index 3e66958..0299158 100644 +--- a/tests/test_tutorial/test_prompt/test_tutorial003.py ++++ b/tests/test_tutorial/test_prompt/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -27,7 +28,7 @@ def test_no_confirm(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial001.py +index e08e273..f4bdf5e 100644 +--- a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial001.py ++++ b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -18,7 +19,7 @@ def test_cli(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial002.py b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial002.py +index 6fdd5b2..301142d 100644 +--- a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial002.py ++++ b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -18,7 +19,7 @@ def test_cli(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py +index 4f92cc8..7ac342d 100644 +--- a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py ++++ b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -23,7 +24,7 @@ def test_for_coverage(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial004.py b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial004.py +index fb4b062..e2d23d0 100644 +--- a/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial004.py ++++ b/tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -25,7 +26,7 @@ def test_for_coverage(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial001.py +index b8cc33e..a332a0d 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial001.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial002.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial002.py +index 244fc84..dc59144 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial002.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial003.py +index 34d27c5..fc72285 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial003.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial004.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial004.py +index 1b29604..5e7cc61 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial004.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial005.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial005.py +index ae90da7..419123f 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial005.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial005.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial006.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial006.py +index bb4328b..519571a 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial006.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial006.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial007.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial007.py +index 3251706..4946085 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial007.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial007.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial008.py b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial008.py +index 121b4c4..5f74898 100644 +--- a/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial008.py ++++ b/tests/test_tutorial/test_subcommands/test_name_help/test_tutorial008.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_command(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_tutorial001.py +index 5cd0bd6..1b8b60e 100644 +--- a/tests/test_tutorial/test_subcommands/test_tutorial001.py ++++ b/tests/test_tutorial/test_subcommands/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import pytest + from typer.testing import CliRunner +@@ -86,7 +87,7 @@ def test_scripts(mod): + + for module in [mod, items, users]: + result = subprocess.run( +- ["coverage", "run", module.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_tutorial002.py b/tests/test_tutorial/test_subcommands/test_tutorial002.py +index 600b03e..c5309d8 100644 +--- a/tests/test_tutorial/test_subcommands/test_tutorial002.py ++++ b/tests/test_tutorial/test_subcommands/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from typer.testing import CliRunner + +@@ -69,7 +70,7 @@ def test_users_delete(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_subcommands/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_tutorial003.py +index 6f0be05..57f1174 100644 +--- a/tests/test_tutorial/test_subcommands/test_tutorial003.py ++++ b/tests/test_tutorial/test_subcommands/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import pytest + from typer.testing import CliRunner +@@ -138,7 +139,7 @@ def test_scripts(mod): + + for module in [mod, items, lands, reigns, towns, users]: + result = subprocess.run( +- ["coverage", "run", module.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_terminating/test_tutorial001.py b/tests/test_tutorial/test_terminating/test_tutorial001.py +index 6df8333..8c9134a 100644 +--- a/tests/test_tutorial/test_terminating/test_tutorial001.py ++++ b/tests/test_tutorial/test_terminating/test_tutorial001.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -27,7 +28,7 @@ def test_existing(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_terminating/test_tutorial002.py b/tests/test_tutorial/test_terminating/test_tutorial002.py +index dd5b5e1..8c599fe 100644 +--- a/tests/test_tutorial/test_terminating/test_tutorial002.py ++++ b/tests/test_tutorial/test_terminating/test_tutorial002.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -25,7 +26,7 @@ def test_root(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_terminating/test_tutorial003.py b/tests/test_tutorial/test_terminating/test_tutorial003.py +index 026f630..e571ade 100644 +--- a/tests/test_tutorial/test_terminating/test_tutorial003.py ++++ b/tests/test_tutorial/test_terminating/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + import typer + from typer.testing import CliRunner +@@ -26,7 +27,7 @@ def test_root(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_testing/test_app01.py b/tests/test_tutorial/test_testing/test_app01.py +index 7e7b529..773941a 100644 +--- a/tests/test_tutorial/test_testing/test_app01.py ++++ b/tests/test_tutorial/test_testing/test_app01.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from docs_src.testing.app01 import main as mod + from docs_src.testing.app01.test_main import test_app +@@ -10,7 +11,7 @@ def test_app01(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_testing/test_app02.py b/tests/test_tutorial/test_testing/test_app02.py +index 429f4db..8c29d38 100644 +--- a/tests/test_tutorial/test_testing/test_app02.py ++++ b/tests/test_tutorial/test_testing/test_app02.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from docs_src.testing.app02 import main as mod + from docs_src.testing.app02.test_main import test_app +@@ -10,7 +11,7 @@ def test_app02(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_testing/test_app03.py b/tests/test_tutorial/test_testing/test_app03.py +index b8cecd9..aea281d 100644 +--- a/tests/test_tutorial/test_testing/test_app03.py ++++ b/tests/test_tutorial/test_testing/test_app03.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from docs_src.testing.app03 import main as mod + from docs_src.testing.app03.test_main import test_app +@@ -10,7 +11,7 @@ def test_app03(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_using_click/test_tutorial003.py b/tests/test_tutorial/test_using_click/test_tutorial003.py +index eadd93e..12a8d49 100644 +--- a/tests/test_tutorial/test_using_click/test_tutorial003.py ++++ b/tests/test_tutorial/test_using_click/test_tutorial003.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from click.testing import CliRunner + +@@ -25,7 +26,7 @@ def test_click(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +diff --git a/tests/test_tutorial/test_using_click/test_tutorial004.py b/tests/test_tutorial/test_using_click/test_tutorial004.py +index ccec78b..06078d7 100644 +--- a/tests/test_tutorial/test_using_click/test_tutorial004.py ++++ b/tests/test_tutorial/test_using_click/test_tutorial004.py +@@ -1,4 +1,5 @@ + import subprocess ++import sys + + from click.testing import CliRunner + +@@ -31,7 +32,7 @@ def test_click_dropdb(): + + def test_script(): + result = subprocess.run( +- ["coverage", "run", mod.__file__, "--help"], ++ [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", +-- +2.35.3 + diff --git a/set-proper-pythonpath-for-tutorial-script-tests.patch b/set-proper-pythonpath-for-tutorial-script-tests.patch new file mode 100644 index 0000000..548ab2c --- /dev/null +++ b/set-proper-pythonpath-for-tutorial-script-tests.patch @@ -0,0 +1,120 @@ +From: Matthias Bach +Date: Fri, 24 Jun 2022 19:54:06 +0200 +Subject: [PATCH] Ensure the PYTHONPATH is set properly when testing the tutorial scripts +References: https://github.com/tiangolo/typer/pull/407 +Upstream: sent + +When packaging Typer for openSUSE I ran into errors because the tutorial +scripts were unable to import their colocated modules. Curiously this +only seems to be occurring when these scripts are run via coverage, as +they are in the tests. Them being run via coverage however also prevents +just changing the working directory for the script runs, as then the +coverage file would end up in the wrong directory. + +Curiously, I have not been able to reproduce this issue on openSUSE Leap +but only seen it on openSUSE Tumbleweed. Thus, there might be something +weird with the Python stack or the coverage version on Tumbleweed. +However, as the same PYTHONPATH-patching is also done for the tests of +the tutorial code that run it directly and not as a subprocess, I think +it is just consistent to also do this for the script test. + +For reference, this is the error that I am observing in the packaging +environment and that gets resolved by this commit: + +[ 123s] =================================== FAILURES =================================== +[ 123s] _________________________________ test_scripts _________________________________ +[ 123s] +[ 123s] mod = +[ 123s] +[ 123s] def test_scripts(mod): +[ 123s] from docs_src.subcommands.tutorial001 import items, users +[ 123s] +[ 123s] for module in [mod, items, users]: +[ 123s] result = subprocess.run( +[ 123s] ["coverage", "run", module.__file__, "--help"], +[ 123s] stdout=subprocess.PIPE, +[ 123s] stderr=subprocess.PIPE, +[ 123s] encoding="utf-8", +[ 123s] ) +[ 123s] > assert "Usage" in result.stdout +[ 123s] E assert 'Usage' in '' +[ 123s] E + where '' = CompletedProcess(args=['coverage', 'run', '/home/abuild/rpmbuild/BUILD/typer-0.4.1/docs_src/subcommands/tutorial001/main.py', '--help'], returncode=1, stdout='', stderr='Traceback (most recent call last):\n File "/home/abuild/rpmbuild/BUILD/typer-0.4.1/docs_src/subcommands/tutorial001/main.py", line 3, in \n import items\nModuleNotFoundError: No module named \'items\'\n').stdout +[ 123s] +[ 123s] tests/test_tutorial/test_subcommands/test_tutorial001.py:94: AssertionError +[ 123s] _________________________________ test_scripts _________________________________ +[ 123s] +[ 123s] mod = +[ 123s] +[ 123s] def test_scripts(mod): +[ 123s] from docs_src.subcommands.tutorial003 import items, lands, reigns, towns, users +[ 123s] +[ 123s] for module in [mod, items, lands, reigns, towns, users]: +[ 123s] result = subprocess.run( +[ 123s] ["coverage", "run", module.__file__, "--help"], +[ 123s] stdout=subprocess.PIPE, +[ 123s] stderr=subprocess.PIPE, +[ 123s] encoding="utf-8", +[ 123s] ) +[ 123s] > assert "Usage" in result.stdout +[ 123s] E assert 'Usage' in '' +[ 123s] E + where '' = CompletedProcess(args=['coverage', 'run', '/home/abuild/rpmbuild/BUILD/typer-0.4.1/docs_src/subcommands/tutorial003/main.py', '--help'], returncode=1, stdout='', stderr='Traceback (most recent call last):\n File "/home/abuild/rpmbuild/BUILD/typer-0.4.1/docs_src/subcommands/tutorial003/main.py", line 3, in \n import items\nModuleNotFoundError: No module named \'items\'\n').stdout +[ 123s] +[ 123s] tests/test_tutorial/test_subcommands/test_tutorial003.py:146: AssertionError +--- + tests/test_tutorial/test_subcommands/test_tutorial001.py | 5 +++++ + tests/test_tutorial/test_subcommands/test_tutorial003.py | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/tests/test_tutorial/test_subcommands/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_tutorial001.py +index 1b8b60e..392cf24 100644 +--- a/tests/test_tutorial/test_subcommands/test_tutorial001.py ++++ b/tests/test_tutorial/test_subcommands/test_tutorial001.py +@@ -1,3 +1,4 @@ ++import os + import subprocess + import sys + +@@ -85,11 +86,15 @@ def test_users_delete(app): + def test_scripts(mod): + from docs_src.subcommands.tutorial001 import items, users + ++ env = os.environ.copy() ++ env["PYTHONPATH"] = ":".join(list(tutorial001.__path__)) ++ + for module in [mod, items, users]: + result = subprocess.run( + [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", ++ env=env, + ) + assert "Usage" in result.stdout +diff --git a/tests/test_tutorial/test_subcommands/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_tutorial003.py +index 57f1174..7de9107 100644 +--- a/tests/test_tutorial/test_subcommands/test_tutorial003.py ++++ b/tests/test_tutorial/test_subcommands/test_tutorial003.py +@@ -1,3 +1,4 @@ ++import os + import subprocess + import sys + +@@ -137,11 +138,15 @@ def test_lands_towns_burn(app): + def test_scripts(mod): + from docs_src.subcommands.tutorial003 import items, lands, reigns, towns, users + ++ env = os.environ.copy() ++ env["PYTHONPATH"] = ":".join(list(tutorial003.__path__)) ++ + for module in [mod, items, lands, reigns, towns, users]: + result = subprocess.run( + [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", ++ env=env, + ) + assert "Usage" in result.stdout +-- +2.35.3 + diff --git a/typer-0.4.0.tar.gz b/typer-0.4.0.tar.gz deleted file mode 100644 index d56b483..0000000 --- a/typer-0.4.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:63c3aeab0549750ffe40da79a1b524f60e08a2cbc3126c520ebf2eeaf507f5dd -size 218979 diff --git a/typer-0.4.1.tar.gz b/typer-0.4.1.tar.gz new file mode 100644 index 0000000..3ffed2a --- /dev/null +++ b/typer-0.4.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5646aef0d936b2c761a10393f0384ee6b5c7fe0bb3e5cd710b17134ca1d99cff +size 221203