Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 62b6cf3

Browse files
committed
[FIX] Warning on test cli quiet
1 parent 90b48d4 commit 62b6cf3

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

tests/test_cli.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
import warnings
34
from unittest import mock
45

56
import pytest
@@ -267,20 +268,25 @@ def test_cli_quiet(testdir):
267268
infile = os.path.join(testdir, "empty.pdf")
268269
outfile = os.path.join(tempdir, "empty.csv")
269270
runner = CliRunner()
270-
271-
result = runner.invoke(
272-
cli, ["--format", "csv", "--output", outfile, "stream", infile]
273-
)
274-
assert "Found 0 tables" in result.output
275-
276-
try:
277-
result = runner.invoke(
278-
cli,
279-
["--quiet", "--format", "csv", "--output", outfile, "stream", infile],
280-
)
281-
except Warning as e:
282-
warning_text = str(e)
283-
pytest.fail(f"Unexpected warning: {warning_text}")
271+
with warnings.catch_warnings():
272+
# the test should fail if any warning is thrown
273+
# warnings.simplefilter("error")
274+
try:
275+
result = runner.invoke(
276+
cli,
277+
[
278+
"--quiet",
279+
"--format",
280+
"csv",
281+
"--output",
282+
outfile,
283+
"stream",
284+
infile,
285+
],
286+
)
287+
except Warning as e:
288+
warning_text = str(e)
289+
pytest.fail(f"Unexpected warning: {warning_text}")
284290

285291

286292
def test_cli_lattice_plot_type():

0 commit comments

Comments
 (0)