From 1f64f554ed221413871263f46fc19404856722ac Mon Sep 17 00:00:00 2001 From: Matthias Bach Date: Fri, 24 Jun 2022 08:45:31 +0200 Subject: [PATCH] Consistently use sys.executable to run subprocesses 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 +- tests/test_tracebacks.py | 7 +-- .../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_help/test_tutorial008.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_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_help/test_tutorial008.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_exceptions/test_tutorial001.py | 7 +-- .../test_exceptions/test_tutorial002.py | 7 +-- .../test_exceptions/test_tutorial003.py | 5 +- .../test_exceptions/test_tutorial004.py | 5 +- .../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_help/test_tutorial001.py | 3 +- .../test_help/test_tutorial002.py | 3 +- .../test_help/test_tutorial003.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_tutorial002.py | 5 +- .../test_tutorial003.py | 5 +- .../test_tutorial004.py | 5 +- .../test_tutorial007.py | 5 +- .../test_tutorial008.py | 5 +- .../test_tutorial009.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 +- 130 files changed, 370 insertions(+), 177 deletions(-) diff --git a/tests/test_compat/test_option_get_help.py b/tests/test_compat/test_option_get_help.py index fb01a6da71..41a9d5269c 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 import typer.core from typer.testing import CliRunner @@ -40,7 +41,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 ee128a3823..7f36547707 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 e4f8b7ebc2..e3fbb3154a 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 c221b69987..bf5762c06d 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 d7c96b95b3..0856b9b565 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 @@ 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 6996fed364..02e70cb8ae 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.commands.index 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 689e1d214a..fb41bdc4f3 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 unittest import mock @@ -97,7 +98,7 @@ def main(name: str = typer.Option(..., callback=name_callback)): 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", @@ -119,7 +120,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", @@ -130,7 +131,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", @@ -152,7 +153,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 06dd8c83c4..58626c7ac2 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_tracebacks.py b/tests/test_tracebacks.py index 06c91fe170..0289e9c942 100644 --- a/tests/test_tracebacks.py +++ b/tests/test_tracebacks.py @@ -1,12 +1,13 @@ import os import subprocess +import sys from pathlib import Path def test_traceback_no_rich(): file_path = Path(__file__).parent / "assets/type_error_no_rich.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", @@ -26,7 +27,7 @@ def test_traceback_no_rich(): def test_traceback_no_rich_short_disable(): file_path = Path(__file__).parent / "assets/type_error_no_rich_short_disable.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", @@ -46,7 +47,7 @@ def test_traceback_no_rich_short_disable(): def test_unmodified_traceback(): file_path = Path(__file__).parent / "assets/type_error_normal_traceback.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", 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 0cb1809d30..00e5734463 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 c1b9e7dc20..11b096b6c2 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 f166602b9c..1567e12565 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 import typer.core @@ -53,7 +54,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 b9f938a019..ce960f4c0c 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 @@ -40,7 +41,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 1b56c61eb1..396ebf23a5 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 af90d3b41e..1822f62a92 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 import typer.core @@ -43,7 +44,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 6434eea459..30a183e1a2 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 64e4f519c4..9a1b8d1666 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 bb9ddbbaac..771fbaf6dc 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 0b527e098b..cf962bb4fe 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 e1a1b1e95b..1b4229edb6 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 2fb6444b1b..3c6eddd028 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 import typer.core @@ -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_tutorial008.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial008.py index ef560be381..f26c6e75ab 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial008.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial008.py @@ -1,4 +1,5 @@ import subprocess +import sys import typer import typer.core @@ -41,7 +42,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 f6fb5610f5..efcf8a11f6 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 import typer.core @@ -42,7 +43,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 9a2de9575f..c616d467ee 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 a5615a0376..f5156699b1 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 52721f30f0..8bda783bb9 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 import typer.core from typer.testing import CliRunner @@ -71,7 +72,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 4fd4e1bb61..d8478d35eb 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 3f13891109..bf0e5f3c50 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 e2d1d2f4db..79432286ce 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 df15d7c390..2e3c7b784c 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 80556fcf4c..6aab364c2a 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 3b15d2739f..6d5b5c37fb 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 3546cc3ad1..8ce5997107 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 339bd5552f..bad756c405 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 @@ -117,7 +118,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 dcadf53f81..f53b5fe6f6 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_help/test_tutorial003.py b/tests/test_tutorial/test_commands/test_help/test_tutorial003.py index 2be83317c4..7d5f47fa62 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial003.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial003.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -36,7 +37,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_commands/test_help/test_tutorial004.py b/tests/test_tutorial/test_commands/test_help/test_tutorial004.py index 59e6779c8d..47b90d945f 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial004.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial004.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -51,7 +52,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_help/test_tutorial005.py b/tests/test_tutorial/test_commands/test_help/test_tutorial005.py index e9227fc9d5..4299d83197 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial005.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial005.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -52,7 +53,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_help/test_tutorial006.py b/tests/test_tutorial/test_commands/test_help/test_tutorial006.py index 91bd5a92ce..14f0815b3b 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial006.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial006.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -43,7 +44,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_commands/test_help/test_tutorial007.py b/tests/test_tutorial/test_commands/test_help/test_tutorial007.py index 15fdb5cf83..3a753040f8 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial007.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial007.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -47,7 +48,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_commands/test_help/test_tutorial008.py b/tests/test_tutorial/test_commands/test_help/test_tutorial008.py index 5d6c7efc7f..b460d9c011 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial008.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial008.py @@ -1,4 +1,5 @@ import subprocess +import sys from typer.testing import CliRunner @@ -24,7 +25,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_commands/test_index/test_tutorial001.py b/tests/test_tutorial/test_commands/test_index/test_tutorial001.py index ddebe83742..fee5e76e19 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 54e3451fde..b49e38be0f 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 e66adf8a88..0dae24f2ed 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 7ecc9072ab..5e76dd90cb 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 eeb4bf3e2f..8af2daffb3 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 d77ad3ab40..ce3307e3f8 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_exceptions/test_tutorial001.py b/tests/test_tutorial/test_exceptions/test_tutorial001.py index 644f415b2e..0a4590bbf5 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial001.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial001.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from pathlib import Path from typer.testing import CliRunner @@ -12,7 +13,7 @@ def test_traceback_rich(): file_path = Path(mod.__file__) 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", @@ -34,7 +35,7 @@ def test_traceback_rich(): def test_standard_traceback_env_var(): file_path = Path(mod.__file__) 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", @@ -55,7 +56,7 @@ def test_standard_traceback_env_var(): 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_exceptions/test_tutorial002.py b/tests/test_tutorial/test_exceptions/test_tutorial002.py index ff79d9bbfd..66286e064d 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial002.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial002.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from pathlib import Path from typer.testing import CliRunner @@ -12,7 +13,7 @@ def test_traceback_rich(): file_path = Path(mod.__file__) result = subprocess.run( - ["coverage", "run", str(file_path), "secret"], + [sys.executable, "-m", "coverage", "run", str(file_path), "secret"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", @@ -34,7 +35,7 @@ def test_traceback_rich(): def test_standard_traceback_env_var(): file_path = Path(mod.__file__) result = subprocess.run( - ["coverage", "run", str(file_path), "secret"], + [sys.executable, "-m", "coverage", "run", str(file_path), "secret"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", @@ -55,7 +56,7 @@ def test_standard_traceback_env_var(): 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_exceptions/test_tutorial003.py b/tests/test_tutorial/test_exceptions/test_tutorial003.py index 54157e1b13..51cb170eba 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial003.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial003.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from pathlib import Path from typer.testing import CliRunner @@ -12,7 +13,7 @@ def test_traceback_rich_pretty_short_disable(): file_path = Path(mod.__file__) 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", @@ -33,7 +34,7 @@ def test_traceback_rich_pretty_short_disable(): 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_exceptions/test_tutorial004.py b/tests/test_tutorial/test_exceptions/test_tutorial004.py index a9aa11ff42..bb575e4eb2 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial004.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial004.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from pathlib import Path from typer.testing import CliRunner @@ -12,7 +13,7 @@ def test_rich_pretty_exceptions_disable(): file_path = Path(mod.__file__) 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", @@ -31,7 +32,7 @@ def test_rich_pretty_exceptions_disable(): 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 8c5438534e..4a465dbe41 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 da66066020..7192545c65 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 400636270a..6c39d849b5 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 9d8158ccf3..c419bb9014 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 @@ -49,7 +50,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 9c9090bb3d..816ab0c413 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 @@ -49,7 +50,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 560191e3b6..08cafe7ff3 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 d4effbc09a..315000bd66 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 7894511260..88e2dfe506 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 7b73c449b8..3c57bfd33e 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 8c4df706a5..d30357e765 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 0e008d39cc..fcb216595c 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 a319f1104d..f5a43d0fbb 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 ea8a8170ca..7726997ff0 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 d41bcc9c31..473cd9d62f 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_help/test_tutorial001.py b/tests/test_tutorial/test_options/test_help/test_tutorial001.py index f9f7d228c3..3e89d55290 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 e3d4b89976..260d6453e8 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 @@ -36,7 +37,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_help/test_tutorial003.py b/tests/test_tutorial/test_options/test_help/test_tutorial003.py index 37506127e1..f6a9826e9b 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial003.py @@ -1,4 +1,5 @@ import subprocess +import sys import typer from typer.testing import CliRunner @@ -27,7 +28,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 6122ccbb4f..2690ff24fa 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 @@ -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_tutorial002.py b/tests/test_tutorial/test_options/test_name/test_tutorial002.py index 3bf243a5f7..5d50e67d1c 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 @@ -34,7 +35,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 3da9985662..729470985a 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 @@ -28,7 +29,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 b6621c5d1a..b0f4b5c612 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 @@ -34,7 +35,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 565e537c00..440c036a09 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 @@ -46,7 +47,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 e4b332191b..588bc97149 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 @@ -34,7 +35,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 36babc8043..fd2048fd25 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 @@ -34,7 +35,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 73ff1c2b7d..ba3204adab 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 @@ -48,7 +49,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 7c6957b016..2e14a9f73e 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 import typer.core @@ -45,7 +46,7 @@ def test_help_no_rich(): 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 cb5c62ee03..a5a706077c 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_options_autocompletion/test_tutorial002.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py index c9d19700d6..3dc81a7624 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -34,7 +35,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_autocompletion/test_tutorial003.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py index 77fee38cdf..e0665232ed 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -34,7 +35,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_autocompletion/test_tutorial004.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py index f2d8dd367d..1aaec9d4ec 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -34,7 +35,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_autocompletion/test_tutorial007.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py index c8bc089587..9af6681eb1 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -35,7 +36,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_autocompletion/test_tutorial008.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py index 06a82affa1..78a787a821 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -37,7 +38,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_autocompletion/test_tutorial009.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py index 692da7ec63..ee7918d5dc 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from typer.testing import CliRunner @@ -10,7 +11,7 @@ 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", @@ -37,7 +38,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_parameter_types/test_bool/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py index 6a526b70ea..cc4b4548fe 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 1ce4ca6d1b..339ebce3b6 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 import typer.core @@ -62,7 +63,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 bfa05991af..83226bd87c 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 @@ -34,7 +35,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 fcc994a673..a01034d6eb 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 @@ -38,7 +39,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 9fad7238f8..f6be63e645 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 @@ -43,7 +44,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 38ebd3cbc5..ec8fc71cd1 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 f79acc1cd5..584b71a0c7 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 @@ -41,7 +42,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 51686d0ad0..293a1760bf 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 4357c9ff9c..061266abc8 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 5556ccd2ba..bbb7696634 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 1387ca26b5..ae452d0ddd 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 6ce004df3b..aa51f39e18 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 841df52720..7f79fd42c0 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 14affe2a3f..62d16a60ab 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 de1dec5fb8..1e08f0d493 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 import typer.core @@ -90,7 +91,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 8827cdfc27..2e33f2e7ba 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 @@ -33,7 +34,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 904b8b0da7..3d0a741cf7 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 0617b573c6..a616d8f141 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 24499fa66e..97c7b7fdb3 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 @@ -39,7 +40,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 5bf406c0a2..b22ad1251c 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 42cbdfc19e..00c9061d19 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 c8a4f3d1d1..1d3aa911c8 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 186f1fb7d0..b34d82301d 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 e08e273331..f4bdf5ef96 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 6fdd5b2de9..301142d1e0 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 4f92cc84ec..7ac342db55 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 fb4b062f8e..e2d23d0b4d 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 f8bc9bfbfb..dfdb9f444a 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 dd9a9e8ca0..dc81bd941d 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 6d86e0f765..af60a9ea44 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 db1ff398a1..75e3ce40f0 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 b122408953..5b5697473e 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 e9e06bf466..4b0b9166e1 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 3371372c63..faffc70083 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 caec2612c3..6a4d238d32 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 5e1d1b4658..c4fca5bdd1 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 d6f32f33de..3e1607d838 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 770da97121..f31e46d351 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 @@ -159,7 +160,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 1030c8bcb8..f6651eb057 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 @@ -35,7 +36,7 @@ def test_existing_no_standalone(): 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 dd5b5e1215..8c599fe976 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 da6ef4c929..7a1909a871 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 import typer.core @@ -44,7 +45,7 @@ def test_root_no_rich(): 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 7e7b5291f0..773941a728 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 429f4dba89..8c29d38bfa 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 b8cecd9949..aea281dea1 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 c3f33e2faf..6bc9bdf22b 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 ccec78b30c..06078d7e50 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",