Skip to content

Commit 1cbe457

Browse files
committed
Parametrize test_help for click 7 and 8
1 parent f1440e0 commit 1cbe457

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

tests/test_cli.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
# stdlib
2-
import re
32
import sys
4-
from typing import Optional
53

64
# 3rd party
75
import pytest
86
from coincidence.regressions import AdvancedFileRegressionFixture
9-
from consolekit.testing import CliRunner
7+
from consolekit.testing import CliRunner, _click_major
108
from domdf_python_tools.words import LF
119

1210
# this package
1311
import formate
1412
from formate.__main__ import main
1513

1614

17-
def test_help(advanced_file_regression: AdvancedFileRegressionFixture):
15+
@pytest.mark.parametrize(
16+
"click_version",
17+
[
18+
pytest.param(
19+
'7',
20+
marks=pytest.mark.skipif(_click_major == 8, reason="Output differs on click 8"),
21+
),
22+
pytest.param(
23+
'8',
24+
marks=pytest.mark.skipif(_click_major != 8, reason="Output differs on click 8"),
25+
),
26+
]
27+
)
28+
def test_help(
29+
advanced_file_regression: AdvancedFileRegressionFixture,
30+
click_version: str,
31+
):
1832

1933
runner = CliRunner()
2034

tests/test_cli_/test_help_7_.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Usage: main [OPTIONS] [FILENAME]...
2+
3+
Reformat the given Python source files.
4+
5+
Options:
6+
-c, --config-file TEXT The path or filename of the TOML configuration file to
7+
use. If a filename is given it is searched for in the
8+
current and parent directories. [default:
9+
formate.toml]
10+
11+
-e, --exclude PATTERN Patterns for files to exclude from formatting.
12+
-v, --verbose Show verbose output.
13+
--colour / --no-colour Whether to use coloured output.
14+
-T, --traceback Show the complete traceback on error.
15+
--diff Show a diff of changes made
16+
--version Show the version and exit.
17+
-h, --help Show this message and exit.

0 commit comments

Comments
 (0)