From bfee1ea541961eb1804fd4b8ebcca6bd653c8c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 12:30:48 -0500 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=A7=20Add=20Ruff=20dependency=20?= =?UTF-8?q?and=20configs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c6e282a545..ad32eade66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,8 +47,7 @@ test = [ "pytest-xdist >=1.32.0,<4.0.0", "pytest-sugar >=0.9.4,<0.10.0", "mypy ==0.971", - "black >=22.3.0,<23.0.0", - "isort >=5.0.6,<6.0.0", + "ruff ==0.2.0", "rich >=10.11.0,<14.0.0", ] doc = [ @@ -59,8 +58,6 @@ doc = [ "cairosvg >=2.5.2,<3.0.0", ] dev = [ - "autoflake >=1.3.1,<2.0.0", - "flake8 >=3.8.3,<4.0.0", "pre-commit >=2.17.0,<3.0.0", ] all = [ @@ -93,3 +90,34 @@ filterwarnings = [ # For pytest-xdist 'ignore::DeprecationWarning:xdist', ] + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "UP", # pyupgrade +] +ignore = [ + "E501", # line too long, handled by black + "B008", # do not perform function calls in argument defaults + "C901", # too complex + "W191", # indentation contains tabs +] + +[tool.ruff.lint.per-file-ignores] +# "__init__.py" = ["F401"] +# This file is more readable without yield from +"docs_src/progressbar/tutorial004.py" = ["UP028"] + +[tool.ruff.lint.isort] +known-third-party = ["typer", "click"] +# For docs_src/subcommands/tutorial003/ +known-first-party = ["reigns", "towns", "lands", "items", "users"] + +[tool.ruff.lint.pyupgrade] +# Preserve types, even if a file imports `from __future__ import annotations`. +keep-runtime-typing = true From e0b062c563aec52312b88033e414d07848c646d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 12:31:09 -0500 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=94=A8=20Update=20format=20script?= =?UTF-8?q?=20with=20Ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/format.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/format.sh b/scripts/format.sh index a01afd98c7..743980a75b 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -1,6 +1,5 @@ #!/bin/sh -e set -x -autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place docs_src typer tests --exclude=__init__.py -black typer tests docs_src -isort typer tests docs_src +ruff typer tests docs_src scripts --fix +ruff format typer tests docs_src scripts From 49a3d29c138b4f6d9ae8ebf7c97316ef610d4254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 12:32:09 -0500 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=94=A8=20Update=20format=20and=20li?= =?UTF-8?q?nt=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/format.sh | 1 + scripts/lint.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/format.sh b/scripts/format.sh index 743980a75b..63b434e0b4 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -1,5 +1,6 @@ #!/bin/sh -e set -x +set -e ruff typer tests docs_src scripts --fix ruff format typer tests docs_src scripts diff --git a/scripts/lint.sh b/scripts/lint.sh index f848ab1a0e..aa2c982271 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -4,5 +4,5 @@ set -e set -x mypy typer -black typer tests docs_src --check -isort typer tests docs_src --check-only +ruff typer tests docs_src scripts +ruff format typer tests --check From 123883c6f6a2a21540493edec148bf047cea4297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 12:33:14 -0500 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=94=A7=20Add=20Ruff=20to=20pre-comm?= =?UTF-8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 673e98b067..3289dd0950 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,43 +13,13 @@ repos: - --unsafe - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.0 hooks: - - id: pyupgrade + - id: ruff args: - - --py3-plus - - --keep-runtime-typing - # This file is more readable without yield from - exclude: ^docs_src/progressbar/tutorial004\.py -- repo: https://github.com/PyCQA/autoflake - rev: v2.2.1 - hooks: - - id: autoflake - args: - - --recursive - - --in-place - - --remove-all-unused-imports - - --remove-unused-variables - - --expand-star-imports - - --exclude - - __init__.py - - --remove-duplicate-keys -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort (python) - - id: isort - name: isort (cython) - types: [cython] - - id: isort - name: isort (pyi) - types: [pyi] -- repo: https://github.com/psf/black - rev: 23.10.0 - hooks: - - id: black + - --fix + - id: ruff-format ci: autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate From 0c79aa3b709e9889134e297d4062c29a5d1407f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 15:16:06 -0500 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=94=A7=20Update=20Ruff=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ad32eade66..0a712fd89d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,9 @@ requires = ["flit_core >=2,<3"] build-backend = "flit_core.buildapi" +[project] +requires-python = ">=3.7" + [tool.flit.metadata] module = "typer" author = "Sebastián Ramírez" @@ -86,7 +89,6 @@ filterwarnings = [ "error", # TODO: until I refactor completion to use the new shell_complete "ignore:'autocompletion' is renamed to 'shell_complete'. The old name is deprecated and will be removed in Click 8.1. See the docs about 'Parameter' for information about new behavior.:DeprecationWarning:typer", - 'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette', # For pytest-xdist 'ignore::DeprecationWarning:xdist', ] @@ -112,6 +114,10 @@ ignore = [ # "__init__.py" = ["F401"] # This file is more readable without yield from "docs_src/progressbar/tutorial004.py" = ["UP028"] +# Default mutable data structure +"docs_src/options_autocompletion/tutorial006_an.py" = ["B006"] +# TODO: refactor _typing.py, remove unnecessary code +"typer/_typing.py" = ["UP036", "F822"] [tool.ruff.lint.isort] known-third-party = ["typer", "click"] From a65506647f4bbbe116ea670e810bc47ece43d40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 15:16:31 -0500 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=8E=A8=20Format=20code=20with=20Ruf?= =?UTF-8?q?f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs_src/arguments/envvar/tutorial002_an.py | 2 +- docs_src/arguments/envvar/tutorial003_an.py | 2 +- docs_src/arguments/help/tutorial004_an.py | 2 +- docs_src/arguments/help/tutorial005.py | 2 +- docs_src/arguments/help/tutorial005_an.py | 2 +- docs_src/commands/help/tutorial001.py | 2 +- docs_src/commands/help/tutorial001_an.py | 2 +- docs_src/commands/help/tutorial004.py | 2 +- docs_src/commands/help/tutorial004_an.py | 2 +- docs_src/commands/help/tutorial005_an.py | 2 +- docs_src/commands/options/tutorial001.py | 4 +- docs_src/commands/options/tutorial001_an.py | 2 +- .../tutorial002.py | 2 +- .../tutorial002_an.py | 2 +- docs_src/options/help/tutorial004.py | 2 +- docs_src/options/help/tutorial004_an.py | 2 +- docs_src/options/prompt/tutorial003_an.py | 2 +- .../options_autocompletion/tutorial002.py | 2 +- .../options_autocompletion/tutorial003.py | 2 +- .../options_autocompletion/tutorial004.py | 2 +- .../options_autocompletion/tutorial005.py | 2 +- .../options_autocompletion/tutorial006_an.py | 2 +- .../options_autocompletion/tutorial007.py | 2 +- .../options_autocompletion/tutorial008.py | 2 +- .../options_autocompletion/tutorial009.py | 2 +- .../parameter_types/datetime/tutorial002.py | 2 +- .../datetime/tutorial002_an.py | 2 +- docs_src/parameter_types/enum/tutorial002.py | 2 +- .../parameter_types/enum/tutorial002_an.py | 2 +- docs_src/parameter_types/path/tutorial002.py | 2 +- .../parameter_types/path/tutorial002_an.py | 2 +- tests/test_ambiguous_params.py | 48 +++++++++++-------- tests/test_compat/test_option_get_help.py | 3 +- tests/test_completion/test_completion.py | 30 ++++-------- .../test_completion_complete.py | 30 ++++-------- .../test_completion_complete_no_help.py | 12 ++--- .../test_completion_install.py | 14 ++---- tests/test_completion/test_completion_show.py | 18 +++---- tests/test_others.py | 14 ++---- tests/test_prog_name.py | 3 +- tests/test_tracebacks.py | 9 ++-- .../test_default/test_tutorial001.py | 3 +- .../test_default/test_tutorial001_an.py | 3 +- .../test_default/test_tutorial002.py | 5 +- .../test_default/test_tutorial002_an.py | 5 +- .../test_envvar/test_tutorial001.py | 3 +- .../test_envvar/test_tutorial001_an.py | 3 +- .../test_envvar/test_tutorial002.py | 3 +- .../test_envvar/test_tutorial002_an.py | 3 +- .../test_envvar/test_tutorial003.py | 3 +- .../test_envvar/test_tutorial003_an.py | 3 +- .../test_help/test_tutorial001.py | 3 +- .../test_help/test_tutorial001_an.py | 3 +- .../test_help/test_tutorial002.py | 3 +- .../test_help/test_tutorial002_an.py | 3 +- .../test_help/test_tutorial003.py | 3 +- .../test_help/test_tutorial003_an.py | 3 +- .../test_help/test_tutorial004.py | 3 +- .../test_help/test_tutorial004_an.py | 3 +- .../test_help/test_tutorial005.py | 3 +- .../test_help/test_tutorial005_an.py | 3 +- .../test_help/test_tutorial006.py | 3 +- .../test_help/test_tutorial006_an.py | 3 +- .../test_help/test_tutorial007.py | 3 +- .../test_help/test_tutorial007_an.py | 3 +- .../test_help/test_tutorial008.py | 3 +- .../test_help/test_tutorial008_an.py | 3 +- .../test_optional/test_tutorial001.py | 3 +- .../test_optional/test_tutorial001_an.py | 3 +- .../test_optional/test_tutorial002.py | 3 +- .../test_optional/test_tutorial002_an.py | 3 +- .../test_optional/test_tutorial003.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_tutorial001_an.py | 3 +- .../test_help/test_tutorial002.py | 3 +- .../test_help/test_tutorial003.py | 3 +- .../test_help/test_tutorial004.py | 3 +- .../test_help/test_tutorial004_an.py | 3 +- .../test_help/test_tutorial005.py | 3 +- .../test_help/test_tutorial005_an.py | 3 +- .../test_help/test_tutorial006.py | 3 +- .../test_help/test_tutorial007.py | 3 +- .../test_help/test_tutorial007_an.py | 3 +- .../test_help/test_tutorial008.py | 3 +- .../test_index/test_tutorial001.py | 3 +- .../test_index/test_tutorial002.py | 3 +- .../test_index/test_tutorial003.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_options/test_tutorial001_an.py | 3 +- .../test_exceptions/test_tutorial001.py | 9 ++-- .../test_exceptions/test_tutorial002.py | 9 ++-- .../test_exceptions/test_tutorial003.py | 6 +-- .../test_exceptions/test_tutorial004.py | 6 +-- .../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_tutorial002_an.py | 3 +- .../test_multiple_options/test_tutorial001.py | 3 +- .../test_tutorial001_an.py | 3 +- .../test_multiple_options/test_tutorial002.py | 3 +- .../test_tutorial002_an.py | 3 +- .../test_tutorial001.py | 3 +- .../test_tutorial001_an.py | 3 +- .../test_callback/test_tutorial001.py | 3 +- .../test_callback/test_tutorial001_an.py | 3 +- .../test_callback/test_tutorial003.py | 6 +-- .../test_callback/test_tutorial003_an.py | 6 +-- .../test_callback/test_tutorial004.py | 6 +-- .../test_callback/test_tutorial004_an.py | 6 +-- .../test_help/test_tutorial001.py | 3 +- .../test_help/test_tutorial001_an.py | 3 +- .../test_help/test_tutorial002.py | 3 +- .../test_help/test_tutorial002_an.py | 3 +- .../test_help/test_tutorial003.py | 3 +- .../test_help/test_tutorial003_an.py | 3 +- .../test_name/test_tutorial001.py | 3 +- .../test_name/test_tutorial001_an.py | 3 +- .../test_name/test_tutorial002.py | 3 +- .../test_name/test_tutorial002_an.py | 3 +- .../test_name/test_tutorial003.py | 3 +- .../test_name/test_tutorial003_an.py | 3 +- .../test_name/test_tutorial004.py | 3 +- .../test_name/test_tutorial004_an.py | 3 +- .../test_name/test_tutorial005.py | 3 +- .../test_name/test_tutorial005_an.py | 3 +- .../test_prompt/test_tutorial001.py | 3 +- .../test_prompt/test_tutorial001_an.py | 3 +- .../test_prompt/test_tutorial002.py | 3 +- .../test_prompt/test_tutorial002_an.py | 3 +- .../test_prompt/test_tutorial003.py | 3 +- .../test_prompt/test_tutorial003_an.py | 3 +- .../test_required/test_tutorial001.py | 3 +- .../test_required/test_tutorial001_an.py | 3 +- .../test_version/test_tutorial003.py | 6 +-- .../test_version/test_tutorial003_an.py | 6 +-- .../test_tutorial002.py | 6 +-- .../test_tutorial002_an.py | 6 +-- .../test_tutorial003.py | 6 +-- .../test_tutorial003_an.py | 6 +-- .../test_tutorial004.py | 6 +-- .../test_tutorial004_an.py | 6 +-- .../test_tutorial007.py | 6 +-- .../test_tutorial007_an.py | 6 +-- .../test_tutorial008.py | 6 +-- .../test_tutorial008_an.py | 6 +-- .../test_tutorial009.py | 6 +-- .../test_tutorial009_an.py | 6 +-- .../test_bool/test_tutorial001.py | 3 +- .../test_bool/test_tutorial001_an.py | 3 +- .../test_bool/test_tutorial002.py | 3 +- .../test_bool/test_tutorial002_an.py | 3 +- .../test_bool/test_tutorial003.py | 3 +- .../test_bool/test_tutorial003_an.py | 3 +- .../test_bool/test_tutorial004.py | 3 +- .../test_bool/test_tutorial004_an.py | 3 +- .../test_custom_types/test_tutorial001.py | 3 +- .../test_custom_types/test_tutorial001_an.py | 3 +- .../test_custom_types/test_tutorial002.py | 3 +- .../test_custom_types/test_tutorial002_an.py | 3 +- .../test_datetime/test_tutorial001.py | 3 +- .../test_datetime/test_tutorial002.py | 3 +- .../test_datetime/test_tutorial002_an.py | 3 +- .../test_enum/test_tutorial001.py | 3 +- .../test_enum/test_tutorial002.py | 3 +- .../test_enum/test_tutorial002_an.py | 3 +- .../test_enum/test_tutorial003.py | 3 +- .../test_enum/test_tutorial003_an.py | 3 +- .../test_file/test_tutorial001.py | 3 +- .../test_file/test_tutorial001_an.py | 3 +- .../test_file/test_tutorial002.py | 3 +- .../test_file/test_tutorial002_an.py | 3 +- .../test_file/test_tutorial003.py | 3 +- .../test_file/test_tutorial003_an.py | 3 +- .../test_file/test_tutorial004.py | 3 +- .../test_file/test_tutorial004_an.py | 3 +- .../test_file/test_tutorial005.py | 3 +- .../test_file/test_tutorial005_an.py | 3 +- .../test_index/test_tutorial001.py | 3 +- .../test_number/test_tutorial001.py | 3 +- .../test_number/test_tutorial001_an.py | 3 +- .../test_number/test_tutorial002.py | 3 +- .../test_number/test_tutorial002_an.py | 3 +- .../test_number/test_tutorial003.py | 3 +- .../test_number/test_tutorial003_an.py | 3 +- .../test_path/test_tutorial001.py | 3 +- .../test_path/test_tutorial001_an.py | 3 +- .../test_path/test_tutorial002.py | 3 +- .../test_path/test_tutorial002_an.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 | 5 +- .../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_testing/test_app02_an.py | 3 +- .../test_tutorial/test_testing/test_app03.py | 3 +- .../test_using_click/test_tutorial003.py | 3 +- .../test_using_click/test_tutorial004.py | 3 +- tests/test_type_conversion.py | 4 +- typer/_completion_shared.py | 12 ++--- typer/_typing.py | 2 +- typer/core.py | 6 +-- typer/main.py | 28 ++++++----- 238 files changed, 352 insertions(+), 599 deletions(-) diff --git a/docs_src/arguments/envvar/tutorial002_an.py b/docs_src/arguments/envvar/tutorial002_an.py index f5373e134a..ebc5575ef0 100644 --- a/docs_src/arguments/envvar/tutorial002_an.py +++ b/docs_src/arguments/envvar/tutorial002_an.py @@ -3,7 +3,7 @@ def main( - name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World" + name: Annotated[str, typer.Argument(envvar=["AWESOME_NAME", "GOD_NAME"])] = "World", ): print(f"Hello Mr. {name}") diff --git a/docs_src/arguments/envvar/tutorial003_an.py b/docs_src/arguments/envvar/tutorial003_an.py index 8cb29195a9..76205d2539 100644 --- a/docs_src/arguments/envvar/tutorial003_an.py +++ b/docs_src/arguments/envvar/tutorial003_an.py @@ -5,7 +5,7 @@ def main( name: Annotated[ str, typer.Argument(envvar="AWESOME_NAME", show_envvar=False) - ] = "World" + ] = "World", ): print(f"Hello Mr. {name}") diff --git a/docs_src/arguments/help/tutorial004_an.py b/docs_src/arguments/help/tutorial004_an.py index 7338d06754..86f7e2e3a5 100644 --- a/docs_src/arguments/help/tutorial004_an.py +++ b/docs_src/arguments/help/tutorial004_an.py @@ -5,7 +5,7 @@ def main( name: Annotated[ str, typer.Argument(help="Who to greet", show_default=False) - ] = "World" + ] = "World", ): """ Say hi to NAME very gently, like Dirk. diff --git a/docs_src/arguments/help/tutorial005.py b/docs_src/arguments/help/tutorial005.py index 55b66b9715..0419a4e352 100644 --- a/docs_src/arguments/help/tutorial005.py +++ b/docs_src/arguments/help/tutorial005.py @@ -4,7 +4,7 @@ def main( name: str = typer.Argument( "Wade Wilson", help="Who to greet", show_default="Deadpoolio the amazing's name" - ) + ), ): print(f"Hello {name}") diff --git a/docs_src/arguments/help/tutorial005_an.py b/docs_src/arguments/help/tutorial005_an.py index 394f54e38f..f61e8b6dcf 100644 --- a/docs_src/arguments/help/tutorial005_an.py +++ b/docs_src/arguments/help/tutorial005_an.py @@ -8,7 +8,7 @@ def main( typer.Argument( help="Who to greet", show_default="Deadpoolio the amazing's name" ), - ] = "Wade Wilson" + ] = "Wade Wilson", ): print(f"Hello {name}") diff --git a/docs_src/commands/help/tutorial001.py b/docs_src/commands/help/tutorial001.py index dda530655d..90726a0b13 100644 --- a/docs_src/commands/help/tutorial001.py +++ b/docs_src/commands/help/tutorial001.py @@ -37,7 +37,7 @@ def delete_all( ..., prompt="Are you sure you want to delete ALL users?", help="Force deletion without confirmation.", - ) + ), ): """ Delete ALL users in the database. diff --git a/docs_src/commands/help/tutorial001_an.py b/docs_src/commands/help/tutorial001_an.py index a7736da05c..748655327c 100644 --- a/docs_src/commands/help/tutorial001_an.py +++ b/docs_src/commands/help/tutorial001_an.py @@ -42,7 +42,7 @@ def delete_all( prompt="Are you sure you want to delete ALL users?", help="Force deletion without confirmation.", ), - ] + ], ): """ Delete ALL users in the database. diff --git a/docs_src/commands/help/tutorial004.py b/docs_src/commands/help/tutorial004.py index 956ddc0d53..1e07817329 100644 --- a/docs_src/commands/help/tutorial004.py +++ b/docs_src/commands/help/tutorial004.py @@ -7,7 +7,7 @@ def create( username: str = typer.Argument( ..., help="The username to be [green]created[/green]" - ) + ), ): """ [bold green]Create[/bold green] a new [italic]shiny[/italic] user. :sparkles: diff --git a/docs_src/commands/help/tutorial004_an.py b/docs_src/commands/help/tutorial004_an.py index d4bad589eb..e5c40e58ee 100644 --- a/docs_src/commands/help/tutorial004_an.py +++ b/docs_src/commands/help/tutorial004_an.py @@ -8,7 +8,7 @@ def create( username: Annotated[ str, typer.Argument(help="The username to be [green]created[/green]") - ] + ], ): """ [bold green]Create[/bold green] a new [italic]shinny[/italic] user. :sparkles: diff --git a/docs_src/commands/help/tutorial005_an.py b/docs_src/commands/help/tutorial005_an.py index 208d97e680..020d4ed85f 100644 --- a/docs_src/commands/help/tutorial005_an.py +++ b/docs_src/commands/help/tutorial005_an.py @@ -6,7 +6,7 @@ @app.command() def create( - username: Annotated[str, typer.Argument(help="The username to be **created**")] + username: Annotated[str, typer.Argument(help="The username to be **created**")], ): """ **Create** a new *shinny* user. :sparkles: diff --git a/docs_src/commands/options/tutorial001.py b/docs_src/commands/options/tutorial001.py index bdc795f520..b8dccd5e71 100644 --- a/docs_src/commands/options/tutorial001.py +++ b/docs_src/commands/options/tutorial001.py @@ -21,7 +21,9 @@ def delete( @app.command() def delete_all( - force: bool = typer.Option(..., prompt="Are you sure you want to delete ALL users?") + force: bool = typer.Option( + ..., prompt="Are you sure you want to delete ALL users?" + ), ): if force: print("Deleting all users") diff --git a/docs_src/commands/options/tutorial001_an.py b/docs_src/commands/options/tutorial001_an.py index bafc4543ca..5d0e1e47e7 100644 --- a/docs_src/commands/options/tutorial001_an.py +++ b/docs_src/commands/options/tutorial001_an.py @@ -26,7 +26,7 @@ def delete( def delete_all( force: Annotated[ bool, typer.Option(prompt="Are you sure you want to delete ALL users?") - ] + ], ): if force: print("Deleting all users") diff --git a/docs_src/multiple_values/arguments_with_multiple_values/tutorial002.py b/docs_src/multiple_values/arguments_with_multiple_values/tutorial002.py index c7003f35d9..8c1e74c227 100644 --- a/docs_src/multiple_values/arguments_with_multiple_values/tutorial002.py +++ b/docs_src/multiple_values/arguments_with_multiple_values/tutorial002.py @@ -6,7 +6,7 @@ def main( names: Tuple[str, str, str] = typer.Argument( ("Harry", "Hermione", "Ron"), help="Select 3 characters to play with" - ) + ), ): for name in names: print(f"Hello {name}") diff --git a/docs_src/multiple_values/arguments_with_multiple_values/tutorial002_an.py b/docs_src/multiple_values/arguments_with_multiple_values/tutorial002_an.py index 7ef3af7e51..46d1a5e208 100644 --- a/docs_src/multiple_values/arguments_with_multiple_values/tutorial002_an.py +++ b/docs_src/multiple_values/arguments_with_multiple_values/tutorial002_an.py @@ -7,7 +7,7 @@ def main( names: Annotated[ Tuple[str, str, str], typer.Argument(help="Select 3 characters to play with") - ] = ("Harry", "Hermione", "Ron") + ] = ("Harry", "Hermione", "Ron"), ): for name in names: print(f"Hello {name}") diff --git a/docs_src/options/help/tutorial004.py b/docs_src/options/help/tutorial004.py index 9aa3e42e14..2faff3fb47 100644 --- a/docs_src/options/help/tutorial004.py +++ b/docs_src/options/help/tutorial004.py @@ -4,7 +4,7 @@ def main( fullname: str = typer.Option( "Wade Wilson", show_default="Deadpoolio the amazing's name" - ) + ), ): print(f"Hello {fullname}") diff --git a/docs_src/options/help/tutorial004_an.py b/docs_src/options/help/tutorial004_an.py index 8913573637..f3b53f2c56 100644 --- a/docs_src/options/help/tutorial004_an.py +++ b/docs_src/options/help/tutorial004_an.py @@ -5,7 +5,7 @@ def main( fullname: Annotated[ str, typer.Option(show_default="Deadpoolio the amazing's name") - ] = "Wade Wilson" + ] = "Wade Wilson", ): print(f"Hello {fullname}") diff --git a/docs_src/options/prompt/tutorial003_an.py b/docs_src/options/prompt/tutorial003_an.py index 63e9097894..c12d1add77 100644 --- a/docs_src/options/prompt/tutorial003_an.py +++ b/docs_src/options/prompt/tutorial003_an.py @@ -3,7 +3,7 @@ def main( - project_name: Annotated[str, typer.Option(prompt=True, confirmation_prompt=True)] + project_name: Annotated[str, typer.Option(prompt=True, confirmation_prompt=True)], ): print(f"Deleting project {project_name}") diff --git a/docs_src/options_autocompletion/tutorial002.py b/docs_src/options_autocompletion/tutorial002.py index 8b18760d47..6c14a97ce4 100644 --- a/docs_src/options_autocompletion/tutorial002.py +++ b/docs_src/options_autocompletion/tutorial002.py @@ -12,7 +12,7 @@ def complete_name(): def main( name: str = typer.Option( "World", help="The name to say hi to.", autocompletion=complete_name - ) + ), ): print(f"Hello {name}") diff --git a/docs_src/options_autocompletion/tutorial003.py b/docs_src/options_autocompletion/tutorial003.py index b2fe534028..9af41f23b5 100644 --- a/docs_src/options_autocompletion/tutorial003.py +++ b/docs_src/options_autocompletion/tutorial003.py @@ -18,7 +18,7 @@ def complete_name(incomplete: str): def main( name: str = typer.Option( "World", help="The name to say hi to.", autocompletion=complete_name - ) + ), ): print(f"Hello {name}") diff --git a/docs_src/options_autocompletion/tutorial004.py b/docs_src/options_autocompletion/tutorial004.py index 9bb08dd196..3be0cf35db 100644 --- a/docs_src/options_autocompletion/tutorial004.py +++ b/docs_src/options_autocompletion/tutorial004.py @@ -23,7 +23,7 @@ def complete_name(incomplete: str): def main( name: str = typer.Option( "World", help="The name to say hi to.", autocompletion=complete_name - ) + ), ): print(f"Hello {name}") diff --git a/docs_src/options_autocompletion/tutorial005.py b/docs_src/options_autocompletion/tutorial005.py index d6efb4fe14..10ac532ad2 100644 --- a/docs_src/options_autocompletion/tutorial005.py +++ b/docs_src/options_autocompletion/tutorial005.py @@ -20,7 +20,7 @@ def complete_name(incomplete: str): def main( name: str = typer.Option( "World", help="The name to say hi to.", autocompletion=complete_name - ) + ), ): print(f"Hello {name}") diff --git a/docs_src/options_autocompletion/tutorial006_an.py b/docs_src/options_autocompletion/tutorial006_an.py index ae208105b0..46319c2ecd 100644 --- a/docs_src/options_autocompletion/tutorial006_an.py +++ b/docs_src/options_autocompletion/tutorial006_an.py @@ -8,7 +8,7 @@ @app.command() def main( - name: Annotated[List[str], typer.Option(help="The name to say hi to.")] = ["World"] + name: Annotated[List[str], typer.Option(help="The name to say hi to.")] = ["World"], ): for each_name in name: print(f"Hello {each_name}") diff --git a/docs_src/options_autocompletion/tutorial007.py b/docs_src/options_autocompletion/tutorial007.py index c60dfe95de..7c56ac7549 100644 --- a/docs_src/options_autocompletion/tutorial007.py +++ b/docs_src/options_autocompletion/tutorial007.py @@ -23,7 +23,7 @@ def complete_name(ctx: typer.Context, incomplete: str): def main( name: List[str] = typer.Option( ["World"], help="The name to say hi to.", autocompletion=complete_name - ) + ), ): for n in name: print(f"Hello {n}") diff --git a/docs_src/options_autocompletion/tutorial008.py b/docs_src/options_autocompletion/tutorial008.py index f90073b15f..118f4dd346 100644 --- a/docs_src/options_autocompletion/tutorial008.py +++ b/docs_src/options_autocompletion/tutorial008.py @@ -26,7 +26,7 @@ def complete_name(args: List[str], incomplete: str): def main( name: List[str] = typer.Option( ["World"], help="The name to say hi to.", autocompletion=complete_name - ) + ), ): for n in name: print(f"Hello {n}") diff --git a/docs_src/options_autocompletion/tutorial009.py b/docs_src/options_autocompletion/tutorial009.py index 829f209031..7e82c7ff07 100644 --- a/docs_src/options_autocompletion/tutorial009.py +++ b/docs_src/options_autocompletion/tutorial009.py @@ -27,7 +27,7 @@ def complete_name(ctx: typer.Context, args: List[str], incomplete: str): def main( name: List[str] = typer.Option( ["World"], help="The name to say hi to.", autocompletion=complete_name - ) + ), ): for n in name: print(f"Hello {n}") diff --git a/docs_src/parameter_types/datetime/tutorial002.py b/docs_src/parameter_types/datetime/tutorial002.py index ad21f7772d..4fbf91a250 100644 --- a/docs_src/parameter_types/datetime/tutorial002.py +++ b/docs_src/parameter_types/datetime/tutorial002.py @@ -6,7 +6,7 @@ def main( launch_date: datetime = typer.Argument( ..., formats=["%Y-%m-%d", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S", "%m/%d/%Y"] - ) + ), ): print(f"Launch will be at: {launch_date}") diff --git a/docs_src/parameter_types/datetime/tutorial002_an.py b/docs_src/parameter_types/datetime/tutorial002_an.py index 6897432df1..661e783f40 100644 --- a/docs_src/parameter_types/datetime/tutorial002_an.py +++ b/docs_src/parameter_types/datetime/tutorial002_an.py @@ -10,7 +10,7 @@ def main( typer.Argument( formats=["%Y-%m-%d", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S", "%m/%d/%Y"] ), - ] + ], ): print(f"Launch will be at: {launch_date}") diff --git a/docs_src/parameter_types/enum/tutorial002.py b/docs_src/parameter_types/enum/tutorial002.py index 545c579541..874971354a 100644 --- a/docs_src/parameter_types/enum/tutorial002.py +++ b/docs_src/parameter_types/enum/tutorial002.py @@ -10,7 +10,7 @@ class NeuralNetwork(str, Enum): def main( - network: NeuralNetwork = typer.Option(NeuralNetwork.simple, case_sensitive=False) + network: NeuralNetwork = typer.Option(NeuralNetwork.simple, case_sensitive=False), ): print(f"Training neural network of type: {network.value}") diff --git a/docs_src/parameter_types/enum/tutorial002_an.py b/docs_src/parameter_types/enum/tutorial002_an.py index 77c1057570..69ea5e146d 100644 --- a/docs_src/parameter_types/enum/tutorial002_an.py +++ b/docs_src/parameter_types/enum/tutorial002_an.py @@ -13,7 +13,7 @@ class NeuralNetwork(str, Enum): def main( network: Annotated[ NeuralNetwork, typer.Option(case_sensitive=False) - ] = NeuralNetwork.simple + ] = NeuralNetwork.simple, ): print(f"Training neural network of type: {network.value}") diff --git a/docs_src/parameter_types/path/tutorial002.py b/docs_src/parameter_types/path/tutorial002.py index b088655d6a..d9121bbc40 100644 --- a/docs_src/parameter_types/path/tutorial002.py +++ b/docs_src/parameter_types/path/tutorial002.py @@ -12,7 +12,7 @@ def main( writable=False, readable=True, resolve_path=True, - ) + ), ): text = config.read_text() print(f"Config file contents: {text}") diff --git a/docs_src/parameter_types/path/tutorial002_an.py b/docs_src/parameter_types/path/tutorial002_an.py index 052d3106dd..2cd0d07cf1 100644 --- a/docs_src/parameter_types/path/tutorial002_an.py +++ b/docs_src/parameter_types/path/tutorial002_an.py @@ -15,7 +15,7 @@ def main( readable=True, resolve_path=True, ), - ] + ], ): text = config.read_text() print(f"Config file contents: {text}") diff --git a/tests/test_ambiguous_params.py b/tests/test_ambiguous_params.py index 7938ac57c8..4dbf09b569 100644 --- a/tests/test_ambiguous_params.py +++ b/tests/test_ambiguous_params.py @@ -35,10 +35,10 @@ def cmd(my_param: Annotated[str, typer.Argument("foo")]): with pytest.raises(AnnotatedParamWithDefaultValueError) as excinfo: runner.invoke(app) - assert vars(excinfo.value) == dict( - param_type=typer.models.ArgumentInfo, - argument_name="my_param", - ) + assert vars(excinfo.value) == { + "param_type": typer.models.ArgumentInfo, + "argument_name": "my_param", + } def test_allow_options_to_have_names(): @@ -70,24 +70,26 @@ def cmd(my_param: Annotated[str, param()] = param("foo")): with pytest.raises(MixedAnnotatedAndDefaultStyleError) as excinfo: runner.invoke(app) - assert vars(excinfo.value) == dict( - argument_name="my_param", - annotated_param_type=param_info_type, - default_param_type=param_info_type, - ) + assert vars(excinfo.value) == { + "argument_name": "my_param", + "annotated_param_type": param_info_type, + "default_param_type": param_info_type, + } def test_forbid_multiple_typer_params_in_annotated(): app = typer.Typer() @app.command() - def cmd(my_param: Annotated[str, typer.Argument(), typer.Argument()]): + def cmd( + my_param: Annotated[str, typer.Argument(), typer.Argument()], + ): ... # pragma: no cover with pytest.raises(MultipleTyperAnnotationsError) as excinfo: runner.invoke(app) - assert vars(excinfo.value) == dict(argument_name="my_param") + assert vars(excinfo.value) == {"argument_name": "my_param"} def test_allow_multiple_non_typer_params_in_annotated(): @@ -117,16 +119,18 @@ def make_string(): app = typer.Typer() @app.command() - def cmd(my_param: Annotated[str, param(default_factory=make_string)] = "hello"): + def cmd( + my_param: Annotated[str, param(default_factory=make_string)] = "hello", + ): ... # pragma: no cover with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo: runner.invoke(app) - assert vars(excinfo.value) == dict( - argument_name="my_param", - param_type=param_info_type, - ) + assert vars(excinfo.value) == { + "argument_name": "my_param", + "param_type": param_info_type, + } @pytest.mark.parametrize( @@ -165,16 +169,18 @@ def make_string(): app = typer.Typer() @app.command() - def cmd(my_param: str = param("hi", default_factory=make_string)): + def cmd( + my_param: str = param("hi", default_factory=make_string), + ): ... # pragma: no cover with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo: runner.invoke(app) - assert vars(excinfo.value) == dict( - argument_name="my_param", - param_type=param_info_type, - ) + assert vars(excinfo.value) == { + "argument_name": "my_param", + "param_type": param_info_type, + } @pytest.mark.parametrize( diff --git a/tests/test_compat/test_option_get_help.py b/tests/test_compat/test_option_get_help.py index c4966dc9b6..baca132cf0 100644 --- a/tests/test_compat/test_option_get_help.py +++ b/tests/test_compat/test_option_get_help.py @@ -42,8 +42,7 @@ def test_coverage_call(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_completion/test_completion.py b/tests/test_completion/test_completion.py index 7f36547707..ae5972a584 100644 --- a/tests/test_completion/test_completion.py +++ b/tests/test_completion/test_completion.py @@ -13,8 +13,7 @@ def test_show_completion(): "-c", f"{sys.executable} -m coverage run {mod.__file__} --show-completion", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"}, ) @@ -32,8 +31,7 @@ def test_install_completion(): "-c", f"{sys.executable} -m coverage run {mod.__file__} --install-completion", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"}, ) @@ -48,8 +46,7 @@ def test_install_completion(): def test_completion_invalid_instruction(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -64,8 +61,7 @@ def test_completion_invalid_instruction(): def test_completion_source_bash(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -82,8 +78,7 @@ def test_completion_source_bash(): def test_completion_source_invalid_shell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -97,8 +92,7 @@ def test_completion_source_invalid_shell(): def test_completion_source_invalid_instruction(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -112,8 +106,7 @@ def test_completion_source_invalid_instruction(): def test_completion_source_zsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -127,8 +120,7 @@ def test_completion_source_zsh(): def test_completion_source_fish(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -142,8 +134,7 @@ def test_completion_source_fish(): def test_completion_source_powershell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -160,8 +151,7 @@ def test_completion_source_powershell(): def test_completion_source_pwsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_completion/test_completion_complete.py b/tests/test_completion/test_completion_complete.py index e3fbb3154a..359768f859 100644 --- a/tests/test_completion/test_completion_complete.py +++ b/tests/test_completion/test_completion_complete.py @@ -8,8 +8,7 @@ def test_completion_complete_subcommand_bash(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -25,8 +24,7 @@ def test_completion_complete_subcommand_bash(): def test_completion_complete_subcommand_bash_invalid(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -42,8 +40,7 @@ def test_completion_complete_subcommand_bash_invalid(): def test_completion_complete_subcommand_zsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -61,8 +58,7 @@ def test_completion_complete_subcommand_zsh(): def test_completion_complete_subcommand_zsh_files(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -77,8 +73,7 @@ def test_completion_complete_subcommand_zsh_files(): def test_completion_complete_subcommand_fish(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -97,8 +92,7 @@ def test_completion_complete_subcommand_fish(): def test_completion_complete_subcommand_fish_should_complete(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -114,8 +108,7 @@ def test_completion_complete_subcommand_fish_should_complete(): def test_completion_complete_subcommand_fish_should_complete_no(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -131,8 +124,7 @@ def test_completion_complete_subcommand_fish_should_complete_no(): def test_completion_complete_subcommand_powershell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -149,8 +141,7 @@ def test_completion_complete_subcommand_powershell(): def test_completion_complete_subcommand_pwsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -167,8 +158,7 @@ def test_completion_complete_subcommand_pwsh(): def test_completion_complete_subcommand_noshell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_completion/test_completion_complete_no_help.py b/tests/test_completion/test_completion_complete_no_help.py index bf5762c06d..c67c77a82b 100644 --- a/tests/test_completion/test_completion_complete_no_help.py +++ b/tests/test_completion/test_completion_complete_no_help.py @@ -8,8 +8,7 @@ def test_completion_complete_subcommand_zsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -25,8 +24,7 @@ def test_completion_complete_subcommand_zsh(): def test_completion_complete_subcommand_fish(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -42,8 +40,7 @@ def test_completion_complete_subcommand_fish(): def test_completion_complete_subcommand_powershell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -58,8 +55,7 @@ def test_completion_complete_subcommand_powershell(): def test_completion_complete_subcommand_pwsh(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_completion/test_completion_install.py b/tests/test_completion/test_completion_install.py index 32c6f71dae..e823e388e4 100644 --- a/tests/test_completion/test_completion_install.py +++ b/tests/test_completion/test_completion_install.py @@ -18,8 +18,7 @@ def test_completion_install_no_shell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--install-completion"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -45,8 +44,7 @@ def test_completion_install_bash(): "--install-completion", "bash", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -88,8 +86,7 @@ def test_completion_install_zsh(): "--install-completion", "zsh", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -125,8 +122,7 @@ def test_completion_install_fish(): "--install-completion", "fish", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -148,7 +144,7 @@ def test_completion_install_fish(): def test_completion_install_powershell(): completion_path: Path = ( - Path.home() / f".config/powershell/Microsoft.PowerShell_profile.ps1" + Path.home() / ".config/powershell/Microsoft.PowerShell_profile.ps1" ) completion_path_bytes = f"{completion_path}\n".encode("windows-1252") text = "" diff --git a/tests/test_completion/test_completion_show.py b/tests/test_completion/test_completion_show.py index 196f27f048..5f94d50747 100644 --- a/tests/test_completion/test_completion_show.py +++ b/tests/test_completion/test_completion_show.py @@ -17,8 +17,7 @@ def test_completion_show_no_shell(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--show-completion"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -40,8 +39,7 @@ def test_completion_show_bash(): "--show-completion", "bash", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -66,8 +64,7 @@ def test_completion_source_zsh(): "--show-completion", "zsh", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -89,8 +86,7 @@ def test_completion_source_fish(): "--show-completion", "fish", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -112,8 +108,7 @@ def test_completion_source_powershell(): "--show-completion", "powershell", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -138,8 +133,7 @@ def test_completion_source_pwsh(): "--show-completion", "pwsh", ], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_others.py b/tests/test_others.py index 3bc7fd7d72..12fa0ae09b 100644 --- a/tests/test_others.py +++ b/tests/test_others.py @@ -145,8 +145,7 @@ def test_completion_untyped_parameters(): file_path = Path(__file__).parent / "assets/completion_no_types.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -163,8 +162,7 @@ def test_completion_untyped_parameters(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Hello World" in result.stdout @@ -174,8 +172,7 @@ def test_completion_untyped_parameters_different_order_correct_names(): file_path = Path(__file__).parent / "assets/completion_no_types_order.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -192,8 +189,7 @@ def test_completion_untyped_parameters_different_order_correct_names(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Hello World" in result.stdout @@ -236,7 +232,7 @@ def main(arg1, arg2: int, arg3: "int", arg4: bool = False, arg5: "bool" = False) def test_context_settings_inheritance_single_command(): - app = typer.Typer(context_settings=dict(help_option_names=["-h", "--help"])) + app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]}) @app.command() def main(name: str): diff --git a/tests/test_prog_name.py b/tests/test_prog_name.py index 58626c7ac2..cfb5a3464f 100644 --- a/tests/test_prog_name.py +++ b/tests/test_prog_name.py @@ -7,8 +7,7 @@ def test_custom_prog_name(): file_path = Path(__file__).parent / "assets/prog_name.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path), "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage: custom-name [OPTIONS] I" in result.stdout diff --git a/tests/test_tracebacks.py b/tests/test_tracebacks.py index 639f36e53f..8c8ab0295d 100644 --- a/tests/test_tracebacks.py +++ b/tests/test_tracebacks.py @@ -8,8 +8,7 @@ def test_traceback_no_rich(): file_path = Path(__file__).parent / "assets/type_error_no_rich.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -24,8 +23,7 @@ def test_traceback_no_rich_short_disable(): file_path = Path(__file__).parent / "assets/type_error_no_rich_short_disable.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -40,8 +38,7 @@ def test_unmodified_traceback(): file_path = Path(__file__).parent / "assets/type_error_normal_traceback.py" result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) 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 00e5734463..cb1836bfd3 100644 --- a/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py +++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial001.py @@ -35,8 +35,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_default/test_tutorial001_an.py b/tests/test_tutorial/test_arguments/test_default/test_tutorial001_an.py index b1d5655366..1db27f81a5 100644 --- a/tests/test_tutorial/test_arguments/test_default/test_tutorial001_an.py +++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial001_an.py @@ -35,8 +35,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 11b096b6c2..9750a6dc7f 100644 --- a/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py +++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial002.py @@ -22,7 +22,7 @@ def test_help(): def test_call_no_arg(): greetings = ["Hello Deadpool", "Hello Rick", "Hello Morty", "Hello Hiro"] - for i in range(3): + for _i in range(3): result = runner.invoke(app) assert result.exit_code == 0 assert any(greet in result.output for greet in greetings) @@ -37,8 +37,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_default/test_tutorial002_an.py b/tests/test_tutorial/test_arguments/test_default/test_tutorial002_an.py index 4bf1332d9c..cf818bde8f 100644 --- a/tests/test_tutorial/test_arguments/test_default/test_tutorial002_an.py +++ b/tests/test_tutorial/test_arguments/test_default/test_tutorial002_an.py @@ -22,7 +22,7 @@ def test_help(): def test_call_no_arg(): greetings = ["Hello Deadpool", "Hello Rick", "Hello Morty", "Hello Hiro"] - for i in range(3): + for _i in range(3): result = runner.invoke(app) assert result.exit_code == 0 assert any(greet in result.output for greet in greetings) @@ -37,8 +37,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 1567e12565..196bdb77bc 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py @@ -55,8 +55,7 @@ def test_call_env_var_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001_an.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001_an.py index 90a5df9f96..73379b6207 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001_an.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial001_an.py @@ -55,8 +55,7 @@ def test_call_env_var_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 ce960f4c0c..b34a601a0b 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py @@ -42,8 +42,7 @@ def test_call_env_var2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002_an.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002_an.py index a62d4e0df2..e8768ff2a3 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002_an.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial002_an.py @@ -42,8 +42,7 @@ def test_call_env_var2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 396ebf23a5..74928cb3a5 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py @@ -42,8 +42,7 @@ def test_call_env_var_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003_an.py b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003_an.py index c1cc2bc8a8..01cc303c20 100644 --- a/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003_an.py +++ b/tests/test_tutorial/test_arguments/test_envvar/test_tutorial003_an.py @@ -42,8 +42,7 @@ def test_call_env_var_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 1822f62a92..1bc7b8d2dd 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial001.py @@ -45,8 +45,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial001_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial001_an.py index 7ca0bf7ce6..9b4c2efa86 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial001_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial001_an.py @@ -45,8 +45,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 30a183e1a2..78c8cd2d11 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial002.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial002_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial002_an.py index 5473708509..f1ad669abc 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial002_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial002_an.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 9a1b8d1666..df486cf199 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial003.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial003_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial003_an.py index 7be39e0b95..e0d09f881f 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial003_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial003_an.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 771fbaf6dc..805753e08e 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial004.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial004_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial004_an.py index 0c87e811b5..c2613a4285 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial004_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial004_an.py @@ -32,8 +32,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 cf962bb4fe..64c99a5271 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial005.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial005_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial005_an.py index 908e8f1d1d..28d8ee57b9 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial005_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial005_an.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 1b4229edb6..4c8abb8a86 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial006.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial006_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial006_an.py index 64a985d26d..e60ec51666 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial006_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial006_an.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 3c6eddd028..56b38254e4 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial007.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial007_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial007_an.py index fae243df06..9be2f57831 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial007_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial007_an.py @@ -30,8 +30,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f26c6e75ab..14d9105454 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial008.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial008.py @@ -43,8 +43,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_help/test_tutorial008_an.py b/tests/test_tutorial/test_arguments/test_help/test_tutorial008_an.py index 66316d2b11..58f06bdd12 100644 --- a/tests/test_tutorial/test_arguments/test_help/test_tutorial008_an.py +++ b/tests/test_tutorial/test_arguments/test_help/test_tutorial008_an.py @@ -43,8 +43,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 efcf8a11f6..46be46cbbd 100644 --- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py +++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py @@ -44,8 +44,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py b/tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py index d1ad8ebde4..45d680b6a3 100644 --- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py +++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py @@ -44,8 +44,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 c616d467ee..ed04c26e19 100644 --- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py +++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py @@ -33,8 +33,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_optional/test_tutorial002_an.py b/tests/test_tutorial/test_arguments/test_optional/test_tutorial002_an.py index 5a0a768976..0696b6b386 100644 --- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial002_an.py +++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial002_an.py @@ -33,8 +33,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py b/tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py index b484ad2266..0d0ad50551 100644 --- a/tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py +++ b/tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py @@ -44,8 +44,7 @@ def test_call_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f5156699b1..fd5abae1ef 100644 --- a/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py @@ -37,8 +37,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 68bcdf1fd0..b2ec90bc6a 100644 --- a/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial001.py @@ -69,8 +69,7 @@ def test_wrong_verbose(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 d8478d35eb..e19ca9d22b 100644 --- a/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py +++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial002.py @@ -20,8 +20,7 @@ def test_app(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 bf0e5f3c50..163341f67e 100644 --- a/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py +++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial003.py @@ -25,8 +25,7 @@ def test_for_coverage(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 79432286ce..23179d66b7 100644 --- a/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py +++ b/tests/test_tutorial/test_commands/test_callback/test_tutorial004.py @@ -27,8 +27,7 @@ def test_app(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 2e3c7b784c..be6c0dce43 100644 --- a/tests/test_tutorial/test_commands/test_context/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_context/test_tutorial001.py @@ -27,8 +27,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 6aab364c2a..a83f81a80c 100644 --- a/tests/test_tutorial/test_commands/test_context/test_tutorial002.py +++ b/tests/test_tutorial/test_commands/test_context/test_tutorial002.py @@ -33,8 +33,7 @@ def test_callback(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 6d5b5c37fb..1ec8f54649 100644 --- a/tests/test_tutorial/test_commands/test_context/test_tutorial003.py +++ b/tests/test_tutorial/test_commands/test_context/test_tutorial003.py @@ -33,8 +33,7 @@ def test_callback(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 8ce5997107..ade78ad252 100644 --- a/tests/test_tutorial/test_commands/test_context/test_tutorial004.py +++ b/tests/test_tutorial/test_commands/test_context/test_tutorial004.py @@ -22,8 +22,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 e2c99e35c4..91f0fb615b 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial001.py @@ -103,8 +103,7 @@ def test_init(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial001_an.py b/tests/test_tutorial/test_commands/test_help/test_tutorial001_an.py index e349718463..0a8667e133 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial001_an.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial001_an.py @@ -103,8 +103,7 @@ def test_init(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f53b5fe6f6..447012dcc4 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial002.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial002.py @@ -50,8 +50,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 7d5f47fa62..d4e423a03e 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial003.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial003.py @@ -38,8 +38,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 1b0ec591b2..20127fc6b3 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial004.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial004.py @@ -53,8 +53,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial004_an.py b/tests/test_tutorial/test_commands/test_help/test_tutorial004_an.py index a7481667f4..f445f89c6e 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial004_an.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial004_an.py @@ -53,8 +53,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f3b160eb99..2cf6de837e 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial005.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial005.py @@ -54,8 +54,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial005_an.py b/tests/test_tutorial/test_commands/test_help/test_tutorial005_an.py index 91af901bb6..002caf4459 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial005_an.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial005_an.py @@ -54,8 +54,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 14f0815b3b..d9da8331cb 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial006.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial006.py @@ -45,8 +45,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 3a753040f8..1f320d7f3c 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial007.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial007.py @@ -49,8 +49,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_help/test_tutorial007_an.py b/tests/test_tutorial/test_commands/test_help/test_tutorial007_an.py index 98c748a36a..2acb91367c 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial007_an.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial007_an.py @@ -49,8 +49,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 b460d9c011..299a4afb58 100644 --- a/tests/test_tutorial/test_commands/test_help/test_tutorial008.py +++ b/tests/test_tutorial/test_commands/test_help/test_tutorial008.py @@ -26,8 +26,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 fee5e76e19..4c978e0ae5 100644 --- a/tests/test_tutorial/test_commands/test_index/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_index/test_tutorial001.py @@ -25,8 +25,7 @@ def test_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 b49e38be0f..fd10fe0204 100644 --- a/tests/test_tutorial/test_commands/test_index/test_tutorial002.py +++ b/tests/test_tutorial/test_commands/test_index/test_tutorial002.py @@ -34,8 +34,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_index/test_tutorial003.py b/tests/test_tutorial/test_commands/test_index/test_tutorial003.py index 89651f9343..8855d3ba53 100644 --- a/tests/test_tutorial/test_commands/test_index/test_tutorial003.py +++ b/tests/test_tutorial/test_commands/test_index/test_tutorial003.py @@ -34,8 +34,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 0dae24f2ed..03ac8f205e 100644 --- a/tests/test_tutorial/test_commands/test_name/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_name/test_tutorial001.py @@ -33,8 +33,7 @@ def test_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 5e76dd90cb..09decc74a2 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 @@ -26,8 +26,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 8af2daffb3..e3b2b013d8 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 @@ -28,8 +28,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f15e76bb5f..955447f156 100644 --- a/tests/test_tutorial/test_commands/test_options/test_tutorial001.py +++ b/tests/test_tutorial/test_commands/test_options/test_tutorial001.py @@ -70,8 +70,7 @@ def test_init(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_commands/test_options/test_tutorial001_an.py b/tests/test_tutorial/test_commands/test_options/test_tutorial001_an.py index 9dd919c0f4..51c6edfc03 100644 --- a/tests/test_tutorial/test_commands/test_options/test_tutorial001_an.py +++ b/tests/test_tutorial/test_commands/test_options/test_tutorial001_an.py @@ -70,8 +70,7 @@ def test_init(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_exceptions/test_tutorial001.py b/tests/test_tutorial/test_exceptions/test_tutorial001.py index 483f4340bb..26b6ca943c 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial001.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial001.py @@ -14,8 +14,7 @@ def test_traceback_rich(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -31,8 +30,7 @@ def test_standard_traceback_env_var(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": "1"}, ) @@ -47,8 +45,7 @@ def test_standard_traceback_env_var(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_exceptions/test_tutorial002.py b/tests/test_tutorial/test_exceptions/test_tutorial002.py index f65cfd6f58..0bcf3671f8 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial002.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial002.py @@ -14,8 +14,7 @@ def test_traceback_rich(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path), "secret"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -31,8 +30,7 @@ def test_standard_traceback_env_var(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path), "secret"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": "1"}, ) @@ -47,8 +45,7 @@ def test_standard_traceback_env_var(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_exceptions/test_tutorial003.py b/tests/test_tutorial/test_exceptions/test_tutorial003.py index 3da786d24d..2c3ed634cd 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial003.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial003.py @@ -14,8 +14,7 @@ def test_traceback_rich_pretty_short_disable(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -30,8 +29,7 @@ def test_traceback_rich_pretty_short_disable(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_exceptions/test_tutorial004.py b/tests/test_tutorial/test_exceptions/test_tutorial004.py index 417e0d4608..c48c4bad61 100644 --- a/tests/test_tutorial/test_exceptions/test_tutorial004.py +++ b/tests/test_tutorial/test_exceptions/test_tutorial004.py @@ -14,8 +14,7 @@ def test_rich_pretty_exceptions_disable(): file_path = Path(mod.__file__) result = subprocess.run( [sys.executable, "-m", "coverage", "run", str(file_path)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""}, ) @@ -29,8 +28,7 @@ def test_rich_pretty_exceptions_disable(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial001.py b/tests/test_tutorial/test_first_steps/test_tutorial001.py index 4a465dbe41..9392282297 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial001.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial001.py @@ -19,8 +19,7 @@ def test_cli(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial002.py b/tests/test_tutorial/test_first_steps/test_tutorial002.py index 7192545c65..766819b51f 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial002.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial002.py @@ -27,8 +27,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial003.py b/tests/test_tutorial/test_first_steps/test_tutorial003.py index 6c39d849b5..d29c798506 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial003.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial003.py @@ -27,8 +27,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial004.py b/tests/test_tutorial/test_first_steps/test_tutorial004.py index c419bb9014..d7f259fbeb 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial004.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial004.py @@ -51,8 +51,7 @@ def test_formal_3(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial005.py b/tests/test_tutorial/test_first_steps/test_tutorial005.py index 816ab0c413..6098bd00be 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial005.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial005.py @@ -51,8 +51,7 @@ def test_formal_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_first_steps/test_tutorial006.py b/tests/test_tutorial/test_first_steps/test_tutorial006.py index 08cafe7ff3..2234c47f63 100644 --- a/tests/test_tutorial/test_first_steps/test_tutorial006.py +++ b/tests/test_tutorial/test_first_steps/test_tutorial006.py @@ -46,8 +46,7 @@ def test_formal_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 315000bd66..4241130c1f 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 @@ -21,8 +21,7 @@ def test_main(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 ad323c3681..4a1c93f1cd 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 @@ -44,8 +44,7 @@ def test_valid_args(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py index e420acb46d..b634c08ef3 100644 --- a/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py +++ b/tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py @@ -46,8 +46,7 @@ def test_valid_args(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 4293ed8d3d..0086df3b80 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 @@ -38,8 +38,7 @@ def test_3_user(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001_an.py b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001_an.py index 20ea235307..fa2ae4497c 100644 --- a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001_an.py +++ b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001_an.py @@ -38,8 +38,7 @@ def test_3_user(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 d30357e765..79aaaaef81 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 @@ -32,8 +32,7 @@ def test_2_number(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002_an.py b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002_an.py index 92fb291cdb..c52f9352a4 100644 --- a/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002_an.py +++ b/tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002_an.py @@ -32,8 +32,7 @@ def test_2_number(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 013b19f873..c225665e6b 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 @@ -41,8 +41,7 @@ def test_invalid_user(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001_an.py b/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001_an.py index de8cfa9f20..44ae98c786 100644 --- a/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001_an.py +++ b/tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001_an.py @@ -41,8 +41,7 @@ def test_invalid_user(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f5a43d0fbb..5c2c19ed77 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial001.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial001.py @@ -27,8 +27,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial001_an.py b/tests/test_tutorial/test_options/test_callback/test_tutorial001_an.py index 7d5cda20cc..5bbe0b08a0 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial001_an.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial001_an.py @@ -27,8 +27,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 7726997ff0..fe2ebd9d08 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial003.py @@ -29,8 +29,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -39,8 +38,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial003_an.py b/tests/test_tutorial/test_options/test_callback/test_tutorial003_an.py index 7bb3754816..cb2715f02e 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial003_an.py @@ -29,8 +29,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -39,8 +38,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, 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 473cd9d62f..68b74448f7 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial004.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial004.py @@ -29,8 +29,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -39,8 +38,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_tutorial/test_options/test_callback/test_tutorial004_an.py b/tests/test_tutorial/test_options/test_callback/test_tutorial004_an.py index 34810f8eef..b410fa7044 100644 --- a/tests/test_tutorial/test_options/test_callback/test_tutorial004_an.py +++ b/tests/test_tutorial/test_options/test_callback/test_tutorial004_an.py @@ -29,8 +29,7 @@ def test_2(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -39,8 +38,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, 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 3e89d55290..bc4d01fb36 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial001.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial001.py @@ -42,8 +42,7 @@ def test_formal(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_help/test_tutorial001_an.py b/tests/test_tutorial/test_options/test_help/test_tutorial001_an.py index 99d3279aac..a1ea0be4a1 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial001_an.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial001_an.py @@ -42,8 +42,7 @@ def test_formal(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 260d6453e8..37c5b72617 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial002.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial002.py @@ -38,8 +38,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_help/test_tutorial002_an.py b/tests/test_tutorial/test_options/test_help/test_tutorial002_an.py index 7d61a41dd8..a8364b017a 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial002_an.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial002_an.py @@ -38,8 +38,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f6a9826e9b..b7b2af2b46 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial003.py @@ -29,8 +29,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_help/test_tutorial003_an.py b/tests/test_tutorial/test_options/test_help/test_tutorial003_an.py index 88e71ab473..948d566308 100644 --- a/tests/test_tutorial/test_options/test_help/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options/test_help/test_tutorial003_an.py @@ -29,8 +29,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 da14c934c1..21c6729ad0 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial001.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial001.py @@ -35,8 +35,7 @@ def test_call_no_args(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial001_an.py b/tests/test_tutorial/test_options/test_name/test_tutorial001_an.py index c5c57b2ee8..6beffcb645 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial001_an.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial001_an.py @@ -35,8 +35,7 @@ def test_call_no_args(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 5d50e67d1c..0b4b8ced41 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial002.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial002.py @@ -36,8 +36,7 @@ def test_call_long(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial002_an.py b/tests/test_tutorial/test_options/test_name/test_tutorial002_an.py index b77c3bcc29..7a3742bf62 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial002_an.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial002_an.py @@ -36,8 +36,7 @@ def test_call_long(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 729470985a..80bd7f2da2 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial003.py @@ -30,8 +30,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py b/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py index cf097e2388..eb15ad2a6b 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py @@ -30,8 +30,7 @@ def test_call(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 b0f4b5c612..93253ac5e5 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial004.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial004.py @@ -36,8 +36,7 @@ def test_call_long(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py b/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py index 087b436d55..f3cc9d958d 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py @@ -36,8 +36,7 @@ def test_call_long(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 440c036a09..fa70682bc8 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial005.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial005.py @@ -48,8 +48,7 @@ def test_call_condensed_wrong_order(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py b/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py index 5ca123f0bd..0a947f7a41 100644 --- a/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py +++ b/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py @@ -48,8 +48,7 @@ def test_call_condensed_wrong_order(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 588bc97149..3ac3deff57 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py @@ -36,8 +36,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py index eb2333c9f6..0592d34db8 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py @@ -36,8 +36,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 fd2048fd25..b037ddb518 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py @@ -36,8 +36,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py index 5d81c6d8d1..fa59426ed3 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py @@ -36,8 +36,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 2684bcedc9..210e5afa5c 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py @@ -45,8 +45,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py b/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py index b163386438..5d1c0865da 100644 --- a/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py @@ -45,8 +45,7 @@ def test_help(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_required/test_tutorial001.py b/tests/test_tutorial/test_options/test_required/test_tutorial001.py index 2e14a9f73e..c4c84ce451 100644 --- a/tests/test_tutorial/test_options/test_required/test_tutorial001.py +++ b/tests/test_tutorial/test_options/test_required/test_tutorial001.py @@ -47,8 +47,7 @@ def test_help_no_rich(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py b/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py index 48d82cf331..259609f0de 100644 --- a/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py +++ b/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py @@ -47,8 +47,7 @@ def test_help_no_rich(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 a5a706077c..4287a5db0c 100644 --- a/tests/test_tutorial/test_options/test_version/test_tutorial003.py +++ b/tests/test_tutorial/test_options/test_version/test_tutorial003.py @@ -34,8 +34,7 @@ def test_3(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -44,8 +43,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py b/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py index 75b024af52..3081cb440f 100644 --- a/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py @@ -34,8 +34,7 @@ def test_3(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout @@ -44,8 +43,7 @@ def test_script(): def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py index 3dc81a7624..49af214900 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py index e23af20fb3..94f32fb21a 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py index e0665232ed..5870e445c3 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py index b8e04cb8e3..6583f9dccf 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py index 1aaec9d4ec..1d7784ad2b 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py index cb951c75a4..30196732c6 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -36,8 +35,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py index 9af6681eb1..bfa2aedb8a 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -37,8 +36,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py index a015f6af9e..6c8c294886 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -37,8 +36,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py index 982c7d94c0..a347237e71 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -38,8 +37,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py index 8c662543ea..ff5c25987c 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -38,8 +37,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py index 999240d970..8d9a73e755 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -38,8 +37,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py b/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py index b56523bcbb..fd4b65f1f1 100644 --- a/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py +++ b/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py @@ -12,8 +12,7 @@ def test_completion(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, " "], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env={ **os.environ, @@ -38,8 +37,7 @@ def test_1(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 356a99284b..61f0f2597c 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 @@ -40,8 +40,7 @@ def test_invalid_no_force(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py index ef92385022..b549583e23 100644 --- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py +++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py @@ -40,8 +40,7 @@ def test_invalid_no_force(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 413ccd4f67..5b537e4314 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 @@ -59,8 +59,7 @@ def test_invalid_no_accept(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py index 0498c3299f..9444596c30 100644 --- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py @@ -59,8 +59,7 @@ def test_invalid_no_accept(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 83226bd87c..794efece57 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 @@ -36,8 +36,7 @@ def test_no_force(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py index c1f09c411b..ef608dd9e8 100644 --- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py +++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py @@ -36,8 +36,7 @@ def test_no_force(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 a01034d6eb..6b891544c6 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 @@ -40,8 +40,7 @@ def test_short_demo(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py index b4d1edeacd..e607310087 100644 --- a/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py +++ b/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py @@ -40,8 +40,7 @@ def test_short_demo(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py index e6a8be69ed..6e21535fa6 100644 --- a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py +++ b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py @@ -32,8 +32,7 @@ def test_parse_custom_type_with_default(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py index 779d86fbf5..7b52d5e1d1 100644 --- a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py +++ b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py @@ -32,8 +32,7 @@ def test_parse_custom_type_with_default(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py index f9e7da08cf..fc72db408a 100644 --- a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py +++ b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py @@ -32,8 +32,7 @@ def test_parse_custom_type_with_default(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py index fe3ce78847..c31d69ae74 100644 --- a/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py @@ -32,8 +32,7 @@ def test_parse_custom_type_with_default(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 215e5deb8a..030bc41396 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 @@ -41,8 +41,7 @@ def test_invalid(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 ec8fc71cd1..0c08f1b046 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 @@ -27,8 +27,7 @@ def test_usa_weird_date_format(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py index ebae67a0ef..d89821bf7f 100644 --- a/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py @@ -27,8 +27,7 @@ def test_usa_weird_date_format(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 3dc997a2d2..67cf7b915a 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 @@ -47,8 +47,7 @@ def test_invalid_other(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 293a1760bf..6c712d3b6e 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 @@ -27,8 +27,7 @@ def test_mix(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002_an.py index c60013daa9..a3c72b7eea 100644 --- a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002_an.py @@ -27,8 +27,7 @@ def test_mix(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003.py b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003.py index 813bf997ae..98c882ebc1 100644 --- a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003.py +++ b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003.py @@ -41,8 +41,7 @@ def test_call_multiple_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003_an.py b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003_an.py index b0bc874e02..46dd4018a5 100644 --- a/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003_an.py +++ b/tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003_an.py @@ -41,8 +41,7 @@ def test_call_multiple_arg(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 061266abc8..24259b1e7e 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 @@ -26,8 +26,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001_an.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001_an.py index 78b4893072..4be35a88a4 100644 --- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001_an.py +++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial001_an.py @@ -26,8 +26,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 bbb7696634..5b6549b380 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 @@ -28,8 +28,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002_an.py index 8f4550fbb7..fcddf8f6c2 100644 --- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial002_an.py @@ -28,8 +28,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 ae452d0ddd..5dda6d3cb8 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 @@ -25,8 +25,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003_an.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003_an.py index 5dc083133b..4b48675ade 100644 --- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003_an.py +++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial003_an.py @@ -25,8 +25,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 aa51f39e18..6821a5e1b8 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 @@ -29,8 +29,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004_an.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004_an.py index 2808609a95..f56d8c6f93 100644 --- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004_an.py +++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial004_an.py @@ -29,8 +29,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 7f79fd42c0..8c1b3b7fff 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 @@ -31,8 +31,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005_an.py b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005_an.py index 1fff5875e8..bd39911425 100644 --- a/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005_an.py +++ b/tests/test_tutorial/test_parameter_types/test_file/test_tutorial005_an.py @@ -31,8 +31,7 @@ def test_main(tmpdir): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 b232dba532..e7ac0a1d4f 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 @@ -41,8 +41,7 @@ def test_invalid(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 efec0467b9..7269255a9b 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 @@ -76,8 +76,7 @@ def test_negative_score(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001_an.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001_an.py index 6bc60beeb2..6e354f77ae 100644 --- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001_an.py +++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial001_an.py @@ -76,8 +76,7 @@ def test_negative_score(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 2bc0e23e17..da8d1c1a6e 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 @@ -31,8 +31,7 @@ def test_clamped(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002_an.py index de1eaa982f..db1a73569f 100644 --- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial002_an.py @@ -31,8 +31,7 @@ def test_clamped(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 3d0a741cf7..a639447c98 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 @@ -51,8 +51,7 @@ def test_verbose_short_3_condensed(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003_an.py b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003_an.py index 4e2a0c7190..71498a9731 100644 --- a/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003_an.py +++ b/tests/test_tutorial/test_parameter_types/test_number/test_tutorial003_an.py @@ -51,8 +51,7 @@ def test_verbose_short_3_condensed(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 a616d8f141..4ad4d2ead5 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 @@ -48,8 +48,7 @@ def test_dir(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001_an.py b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001_an.py index efa6097c2f..7c4699186d 100644 --- a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001_an.py +++ b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial001_an.py @@ -48,8 +48,7 @@ def test_dir(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 97c7b7fdb3..069c24a910 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 @@ -41,8 +41,7 @@ def test_dir(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002_an.py b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002_an.py index ae93fae160..54d79ccaf8 100644 --- a/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002_an.py +++ b/tests/test_tutorial/test_parameter_types/test_path/test_tutorial002_an.py @@ -41,8 +41,7 @@ def test_dir(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 0f60bc544d..aa9503e908 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 @@ -31,8 +31,7 @@ def test_invalid_uuid(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_prompt/test_tutorial001.py b/tests/test_tutorial/test_prompt/test_tutorial001.py index 00c9061d19..4b01d6d42d 100644 --- a/tests/test_tutorial/test_prompt/test_tutorial001.py +++ b/tests/test_tutorial/test_prompt/test_tutorial001.py @@ -22,8 +22,7 @@ def test_cli(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_prompt/test_tutorial002.py b/tests/test_tutorial/test_prompt/test_tutorial002.py index 1d3aa911c8..9ed3c2d152 100644 --- a/tests/test_tutorial/test_prompt/test_tutorial002.py +++ b/tests/test_tutorial/test_prompt/test_tutorial002.py @@ -30,8 +30,7 @@ def test_no_confirm(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_prompt/test_tutorial003.py b/tests/test_tutorial/test_prompt/test_tutorial003.py index b34d82301d..962ceca6ef 100644 --- a/tests/test_tutorial/test_prompt/test_tutorial003.py +++ b/tests/test_tutorial/test_prompt/test_tutorial003.py @@ -29,8 +29,7 @@ def test_no_confirm(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 f4bdf5ef96..ec76dfebf1 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 @@ -20,8 +20,7 @@ def test_cli(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 301142d1e0..bfe8c35278 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 @@ -20,8 +20,7 @@ def test_cli(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 7ac342db55..eb289a1443 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 @@ -25,8 +25,7 @@ def test_for_coverage(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 e2d23d0b4d..f22b77f916 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 @@ -27,8 +27,7 @@ def test_for_coverage(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 dfdb9f444a..fad028d416 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 dc81bd941d..d65b60a287 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 af60a9ea44..0b64a47954 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 75e3ce40f0..667ce75a4a 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 5b5697473e..815af7c126 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 4b0b9166e1..cf2117965e 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 faffc70083..3935dee2da 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout 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 6a4d238d32..17f0826ca8 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 @@ -33,8 +33,7 @@ def test_command(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_subcommands/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_tutorial001.py index 1280e22f5a..6b228bd788 100644 --- a/tests/test_tutorial/test_subcommands/test_tutorial001.py +++ b/tests/test_tutorial/test_subcommands/test_tutorial001.py @@ -12,7 +12,7 @@ @pytest.fixture() def mod(monkeypatch): - with monkeypatch.context() as m: + with monkeypatch.context(): monkeypatch.syspath_prepend(list(tutorial001.__path__)[0]) from docs_src.subcommands.tutorial001 import main @@ -92,8 +92,7 @@ def test_scripts(mod): for module in [mod, items, users]: result = subprocess.run( [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env=env, ) diff --git a/tests/test_tutorial/test_subcommands/test_tutorial002.py b/tests/test_tutorial/test_subcommands/test_tutorial002.py index 3e1607d838..2b86bb3730 100644 --- a/tests/test_tutorial/test_subcommands/test_tutorial002.py +++ b/tests/test_tutorial/test_subcommands/test_tutorial002.py @@ -71,8 +71,7 @@ def test_users_delete(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_subcommands/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_tutorial003.py index 2d6149cf6a..d109cb47d1 100644 --- a/tests/test_tutorial/test_subcommands/test_tutorial003.py +++ b/tests/test_tutorial/test_subcommands/test_tutorial003.py @@ -165,8 +165,7 @@ def test_scripts(mod): for module in [mod, items, lands, reigns, towns, users]: result = subprocess.run( [sys.executable, "-m", "coverage", "run", module.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", env=env, ) diff --git a/tests/test_tutorial/test_terminating/test_tutorial001.py b/tests/test_tutorial/test_terminating/test_tutorial001.py index f6651eb057..6306fc2e15 100644 --- a/tests/test_tutorial/test_terminating/test_tutorial001.py +++ b/tests/test_tutorial/test_terminating/test_tutorial001.py @@ -37,8 +37,7 @@ def test_existing_no_standalone(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_terminating/test_tutorial002.py b/tests/test_tutorial/test_terminating/test_tutorial002.py index 8c599fe976..89f13bac8b 100644 --- a/tests/test_tutorial/test_terminating/test_tutorial002.py +++ b/tests/test_tutorial/test_terminating/test_tutorial002.py @@ -27,8 +27,7 @@ def test_root(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_terminating/test_tutorial003.py b/tests/test_tutorial/test_terminating/test_tutorial003.py index 7a1909a871..8fc5f68de4 100644 --- a/tests/test_tutorial/test_terminating/test_tutorial003.py +++ b/tests/test_tutorial/test_terminating/test_tutorial003.py @@ -46,8 +46,7 @@ def test_root_no_rich(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_testing/test_app01.py b/tests/test_tutorial/test_testing/test_app01.py index 773941a728..89acf56280 100644 --- a/tests/test_tutorial/test_testing/test_app01.py +++ b/tests/test_tutorial/test_testing/test_app01.py @@ -12,8 +12,7 @@ def test_app01(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_testing/test_app02.py b/tests/test_tutorial/test_testing/test_app02.py index 8c29d38bfa..e95e13ca5c 100644 --- a/tests/test_tutorial/test_testing/test_app02.py +++ b/tests/test_tutorial/test_testing/test_app02.py @@ -12,8 +12,7 @@ def test_app02(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_testing/test_app02_an.py b/tests/test_tutorial/test_testing/test_app02_an.py index 140a7e37ca..89764d6316 100644 --- a/tests/test_tutorial/test_testing/test_app02_an.py +++ b/tests/test_tutorial/test_testing/test_app02_an.py @@ -12,8 +12,7 @@ def test_app02_an(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_testing/test_app03.py b/tests/test_tutorial/test_testing/test_app03.py index aea281dea1..3f65d47806 100644 --- a/tests/test_tutorial/test_testing/test_app03.py +++ b/tests/test_tutorial/test_testing/test_app03.py @@ -12,8 +12,7 @@ def test_app03(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_using_click/test_tutorial003.py b/tests/test_tutorial/test_using_click/test_tutorial003.py index 55f7f16f9e..1dd26a7e04 100644 --- a/tests/test_tutorial/test_using_click/test_tutorial003.py +++ b/tests/test_tutorial/test_using_click/test_tutorial003.py @@ -34,8 +34,7 @@ def test_click(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_using_click/test_tutorial004.py b/tests/test_tutorial/test_using_click/test_tutorial004.py index 06078d7e50..72800aec60 100644 --- a/tests/test_tutorial/test_using_click/test_tutorial004.py +++ b/tests/test_tutorial/test_using_click/test_tutorial004.py @@ -33,8 +33,7 @@ def test_click_dropdb(): def test_script(): result = subprocess.run( [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) assert "Usage" in result.stdout diff --git a/tests/test_type_conversion.py b/tests/test_type_conversion.py index a4102daadc..21ad57436c 100644 --- a/tests/test_type_conversion.py +++ b/tests/test_type_conversion.py @@ -98,7 +98,7 @@ def test_custom_parse(): @app.command() def custom_parser( - hex_value: int = typer.Argument(None, parser=lambda x: int(x, 0)) + hex_value: int = typer.Argument(None, parser=lambda x: int(x, 0)), ): assert hex_value == 0x56 @@ -122,7 +122,7 @@ def convert( @app.command() def custom_click_type( - hex_value: int = typer.Argument(None, click_type=BaseNumberParamType()) + hex_value: int = typer.Argument(None, click_type=BaseNumberParamType()), ): assert hex_value == 0x56 diff --git a/typer/_completion_shared.py b/typer/_completion_shared.py index 3202e18ed8..1fb82e8406 100644 --- a/typer/_completion_shared.py +++ b/typer/_completion_shared.py @@ -87,11 +87,11 @@ def get_completion_script(*, prog_name: str, complete_var: str, shell: str) -> s raise click.exceptions.Exit(1) return ( script - % dict( - complete_func="_{}_completion".format(cf_name), - prog_name=prog_name, - autocomplete_var=complete_var, - ) + % { + "complete_func": f"_{cf_name}_completion", + "prog_name": prog_name, + "autocomplete_var": complete_var, + } ).strip() @@ -191,7 +191,7 @@ def install_powershell(*, prog_name: str, complete_var: str, shell: str) -> Path path_str = result.stdout.decode("utf8") except UnicodeDecodeError: click.echo("Couldn't decode the path automatically", err=True) - raise click.exceptions.Exit(1) + raise path_obj = Path(path_str.strip()) parent_dir: Path = path_obj.parent parent_dir.mkdir(parents=True, exist_ok=True) diff --git a/typer/_typing.py b/typer/_typing.py index bfa8114fcb..b1d2483da0 100644 --- a/typer/_typing.py +++ b/typer/_typing.py @@ -252,7 +252,7 @@ def convert_generics(tp: Type[Any]) -> Type[Any]: return _UnionGenericAlias(origin, converted) else: try: - setattr(tp, "__args__", converted) + setattr(tp, "__args__", converted) # noqa: B010 except AttributeError: pass return tp diff --git a/typer/core.py b/typer/core.py index c56acf8522..fd534483df 100644 --- a/typer/core.py +++ b/typer/core.py @@ -200,9 +200,9 @@ def _main( # even always obvious that `rv` indicates success/failure # by its truthiness/falsiness ctx.exit() - except (EOFError, KeyboardInterrupt): + except (EOFError, KeyboardInterrupt) as e: click.echo(file=sys.stderr) - raise click.Abort() + raise click.Abort() from e except click.ClickException as e: if not standalone_mode: raise @@ -370,7 +370,7 @@ def make_metavar(self) -> str: return self.metavar var = (self.name or "").upper() if not self.required: - var = "[{}]".format(var) + var = f"[{var}]" type_var = self.type.get_metavar(self) if type_var: var += f":{type_var}" diff --git a/typer/main.py b/typer/main.py index 21683d913a..74de1560e3 100644 --- a/typer/main.py +++ b/typer/main.py @@ -81,9 +81,7 @@ def except_hook( tb_exc = traceback.TracebackException.from_exception(exc) stack: List[FrameSummary] = [] for frame in tb_exc.stack: - if any( - [frame.filename.startswith(path) for path in supress_internal_dir_names] - ): + if any(frame.filename.startswith(path) for path in supress_internal_dir_names): if not exception_config.pretty_exceptions_short: # Hide the line for internal libraries, Typer and Click stack.append( @@ -370,7 +368,9 @@ def get_command(typer_instance: Typer) -> click.Command: click_command.params.append(click_install_param) click_command.params.append(click_show_param) return click_command - assert False, "Could not get a command for this Typer instance" # pragma no cover + raise RuntimeError( + "Could not get a command for this Typer instance" + ) # pragma no cover def get_group_name(typer_info: TyperInfo) -> Optional[str]: @@ -444,7 +444,8 @@ def solve_typer_info_defaults(typer_info: TyperInfo) -> TyperInfo: # Priority 2: Value was set in @subapp.callback() try: callback_value = getattr( - typer_info.typer_instance.registered_callback, name # type: ignore + typer_info.typer_instance.registered_callback, # type: ignore + name, ) if not isinstance(callback_value, DefaultPlaceholder): values[name] = callback_value @@ -454,7 +455,8 @@ def solve_typer_info_defaults(typer_info: TyperInfo) -> TyperInfo: # Priority 3: Value set in subapp = typer.Typer() try: instance_value = getattr( - typer_info.typer_instance.info, name # type: ignore + typer_info.typer_instance.info, # type: ignore + name, ) if not isinstance(instance_value, DefaultPlaceholder): values[name] = instance_value @@ -539,7 +541,7 @@ def get_command_name(name: str) -> str: def get_params_convertors_ctx_param_name_from_function( - callback: Optional[Callable[..., Any]] + callback: Optional[Callable[..., Any]], ) -> Tuple[List[Union[click.Argument, click.Option]], Dict[str, Any], Optional[str]]: params = [] convertors = {} @@ -659,10 +661,12 @@ def get_callback( *, callback: Optional[Callable[..., Any]] = None, params: Sequence[click.Parameter] = [], - convertors: Dict[str, Callable[[str], Any]] = {}, + convertors: Dict[str, Callable[[str], Any]] = None, context_param_name: Optional[str] = None, pretty_exceptions_short: bool, ) -> Optional[Callable[..., Any]]: + if convertors is None: + convertors = {} if not callback: return None parameters = get_params_from_function(callback) @@ -860,7 +864,7 @@ def get_click_param( if is_tuple: convertor = generate_tuple_convertor(main_type.__args__) if isinstance(parameter_info, OptionInfo): - if main_type is bool and not (parameter_info.is_flag is False): + if main_type is bool and parameter_info.is_flag is not False: is_flag = True # Click doesn't accept a flag of type bool, only None, and then it sets it # to bool internally @@ -946,7 +950,7 @@ def get_click_param( ), convertor, ) - assert False, "A click.Parameter should be returned" # pragma no cover + raise AssertionError("A click.Parameter should be returned") # pragma no cover def get_param_callback( @@ -1002,7 +1006,7 @@ def wrapper(ctx: click.Context, param: click.Parameter, value: Any) -> Any: def get_param_completion( - callback: Optional[Callable[..., Any]] = None + callback: Optional[Callable[..., Any]] = None, ) -> Optional[Callable[..., Any]]: if not callback: return None @@ -1010,7 +1014,7 @@ def get_param_completion( ctx_name = None args_name = None incomplete_name = None - unassigned_params = [param for param in parameters.values()] + unassigned_params = list(parameters.values()) for param_sig in unassigned_params[:]: origin = getattr(param_sig.annotation, "__origin__", None) if lenient_issubclass(param_sig.annotation, click.Context): From 49ab165d3b44b4079bb72cfa185f6f0f3b0cc3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 15:22:51 -0500 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=94=A7=20Update=20Ruff=20config=20a?= =?UTF-8?q?nd=20ignores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0a712fd89d..ce6e68af9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,9 +113,24 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # "__init__.py" = ["F401"] # This file is more readable without yield from -"docs_src/progressbar/tutorial004.py" = ["UP028"] +"docs_src/progressbar/tutorial004.py" = ["UP028", "B007"] # Default mutable data structure "docs_src/options_autocompletion/tutorial006_an.py" = ["B006"] +"docs_src/multiple_values/multiple_options/tutorial002_an.py" = ["B006"] +"docs_src/options_autocompletion/tutorial007_an.py" = ["B006"] +"docs_src/options_autocompletion/tutorial008_an.py" = ["B006"] +"docs_src/options_autocompletion/tutorial009_an.py" = ["B006"] +"docs_src/parameter_types/enum/tutorial003_an.py" = ["B006"] +# Loop control variable `value` not used within loop body +"docs_src/progressbar/tutorial001.py" = ["B007"] +"docs_src/progressbar/tutorial003.py" = ["B007"] +"docs_src/progressbar/tutorial005.py" = ["B007"] +"docs_src/progressbar/tutorial006.py" = ["B007"] +# Local variable `delete` is assigned to but never used +"docs_src/prompt/tutorial003.py" = ["F841"] +# Loop control variable `x` not used within loop body +"docs_src/using_click/tutorial001.py" = ["B007"] + # TODO: refactor _typing.py, remove unnecessary code "typer/_typing.py" = ["UP036", "F822"] From d0893ee380036cf912a16a932c95ce6c502dadd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 16:31:56 -0500 Subject: [PATCH 08/10] =?UTF-8?q?=E2=9E=95=20Add=20Ruff=20to=20dependencie?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements-tests.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index e7850a4c06..74ba25fb41 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -6,5 +6,4 @@ coverage[toml] >=6.2,<7.0 pytest-xdist >=1.32.0,<4.0.0 pytest-sugar >=0.9.4,<0.10.0 mypy ==0.971 -black >=22.3.0,<23.0.0 -isort >=5.0.6,<6.0.0 +ruff ==0.2.0 From b856f0dcaaf8f7a8e0d27412835f1362570d5d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 16:34:35 -0500 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typer/main.py b/typer/main.py index 74de1560e3..678541ac71 100644 --- a/typer/main.py +++ b/typer/main.py @@ -661,7 +661,7 @@ def get_callback( *, callback: Optional[Callable[..., Any]] = None, params: Sequence[click.Parameter] = [], - convertors: Dict[str, Callable[[str], Any]] = None, + convertors: Optional[Dict[str, Callable[[str], Any]]] = None, context_param_name: Optional[str] = None, pretty_exceptions_short: bool, ) -> Optional[Callable[..., Any]]: From 73838f2928ef211832779dd17c7a43c7d3eccf94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Mar 2024 16:36:20 -0500 Subject: [PATCH 10/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Format=20for=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/typer/main.py b/typer/main.py index 678541ac71..88ccbc07b5 100644 --- a/typer/main.py +++ b/typer/main.py @@ -665,8 +665,7 @@ def get_callback( context_param_name: Optional[str] = None, pretty_exceptions_short: bool, ) -> Optional[Callable[..., Any]]: - if convertors is None: - convertors = {} + use_convertors = convertors or {} if not callback: return None parameters = get_params_from_function(callback) @@ -680,8 +679,8 @@ def get_callback( def wrapper(**kwargs: Any) -> Any: _rich_traceback_guard = pretty_exceptions_short # noqa: F841 for k, v in kwargs.items(): - if k in convertors: - use_params[k] = convertors[k](v) + if k in use_convertors: + use_params[k] = use_convertors[k](v) else: use_params[k] = v if context_param_name: