Skip to content

Commit d3cd0a5

Browse files
authored
tests: fix rich-click's self-inflicted warnings (#211)
* tests: fix rich-click's self-inflicted warnings Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Apply suggestions from code review --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent dae8024 commit d3cd0a5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ xfail_strict = true
9292
log_cli_level = "INFO"
9393
filterwarnings = [
9494
"error",
95+
"ignore:OptionHighlighter:DeprecationWarning", # rich-click triggers its own warning
96+
"ignore:`highlighter`:DeprecationWarning", # rich-click triggers its own warning
9597
]
9698
testpaths = ["tests"]
9799
pythonpath = ["tests/test_utilities"]

tests/test_multi.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def multiple_packages(tmp_path: Path) -> tuple[str, str]:
4141
@pytest.mark.usefixtures("local_entry_points")
4242
def test_multiple_packages_rich(multiple_packages: Sequence[str]) -> None:
4343
runner = CliRunner()
44-
result = runner.invoke(main, [*multiple_packages])
44+
result = runner.invoke(main, [*multiple_packages], catch_exceptions=False)
4545
assert result.exit_code == 0
4646
assert "package_1" in result.output
4747
assert "package_2" in result.output
@@ -51,7 +51,9 @@ def test_multiple_packages_rich(multiple_packages: Sequence[str]) -> None:
5151
@pytest.mark.usefixtures("local_entry_points")
5252
def test_multiple_packages_json(multiple_packages: Sequence[str]) -> None:
5353
runner = CliRunner()
54-
result = runner.invoke(main, [*multiple_packages, "--format", "json"])
54+
result = runner.invoke(
55+
main, [*multiple_packages, "--format", "json"], catch_exceptions=False
56+
)
5557
assert result.exit_code == 0
5658
output = json.loads(result.output)
5759
assert len(output) == 2
@@ -62,7 +64,9 @@ def test_multiple_packages_json(multiple_packages: Sequence[str]) -> None:
6264
@pytest.mark.usefixtures("local_entry_points")
6365
def test_multiple_packages_html(multiple_packages: Sequence[str]) -> None:
6466
runner = CliRunner()
65-
result = runner.invoke(main, [*multiple_packages, "--format", "html"])
67+
result = runner.invoke(
68+
main, [*multiple_packages, "--format", "html"], catch_exceptions=False
69+
)
6670
assert result.exit_code == 0
6771
tree = ET.fromstring(f"<body>{result.output}</body>")
6872
assert len(tree) == 2

0 commit comments

Comments
 (0)