Skip to content

Commit 74e0923

Browse files
authored
⬆️ Add compatibility with Click 8.2 (#1222)
1 parent 3ce5032 commit 74e0923

32 files changed

+167
-46
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Environment variables automatically read by VS Code, e.g. running tests
2+
3+
# For tests, a large terminal width
4+
TERMINAL_WIDTH=3000

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
- name: Install Dependencies
5858
run: uv pip install -r requirements-tests.txt
5959
- name: Lint
60+
if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9'
6061
run: bash scripts/lint.sh
6162
- run: mkdir coverage
6263
- run: bash ./scripts/test-files.sh

docs/tutorial/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Then we check that the text printed to "standard output" contains the text that
7171

7272
/// tip
7373

74-
You could also check output sent to "standard error" (`stderr`) instead of "standard output" (`stdout`). To do so, make sure your `CliRunner` instance is created with the `mix_stderr=False` argument. You need this setting to be able to access `result.stderr` in tests.
74+
You could also check the output sent to "standard error" (`stderr`) or "standard output" (`stdout`) independently by accessing `result.stdout` and `result.stderr` in your tests.
7575

7676
///
7777

docs_src/testing/app01/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
def test_app():
99
result = runner.invoke(app, ["Camila", "--city", "Berlin"])
1010
assert result.exit_code == 0
11-
assert "Hello Camila" in result.stdout
12-
assert "Let's have a coffee in Berlin" in result.stdout
11+
assert "Hello Camila" in result.output
12+
assert "Let's have a coffee in Berlin" in result.output

docs_src/testing/app02/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
def test_app():
99
result = runner.invoke(app, ["Camila"], input="[email protected]\n")
1010
assert result.exit_code == 0
11-
assert "Hello Camila, your email is: [email protected]" in result.stdout
11+
assert "Hello Camila, your email is: [email protected]" in result.output

docs_src/testing/app02_an/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
def test_app():
99
result = runner.invoke(app, ["Camila"], input="[email protected]\n")
1010
assert result.exit_code == 0
11-
assert "Hello Camila, your email is: [email protected]" in result.stdout
11+
assert "Hello Camila, your email is: [email protected]" in result.output

docs_src/testing/app03/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
def test_app():
1313
result = runner.invoke(app, ["--name", "Camila"])
1414
assert result.exit_code == 0
15-
assert "Hello Camila" in result.stdout
15+
assert "Hello Camila" in result.output

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ classifiers = [
3434
"License :: OSI Approved :: MIT License",
3535
]
3636
dependencies = [
37-
"click >= 8.0.0,<8.2",
37+
"click >= 8.0.0",
3838
"typing-extensions >= 3.7.4.3",
3939
]
4040
readme = "README.md"

tests/test_completion/test_completion_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@ def test_completion_show_invalid_shell():
146146
shellingham, "detect_shell", return_value=("xshell", "/usr/bin/xshell")
147147
):
148148
result = runner.invoke(app, ["--show-completion"])
149-
assert "Shell xshell not supported" in result.stdout
149+
assert "Shell xshell not supported" in result.output

tests/test_tutorial/test_commands/test_index/test_tutorial003.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
def test_no_arg():
1414
result = runner.invoke(app)
15-
assert result.exit_code == 0
1615
assert "[OPTIONS] COMMAND [ARGS]..." in result.output
1716
assert "Commands" in result.output
1817
assert "create" in result.output

0 commit comments

Comments
 (0)