Skip to content

Commit

Permalink
[FIX] Warning on test cli quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Oct 19, 2024
1 parent 90b48d4 commit 62b6cf3
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import warnings
from unittest import mock

import pytest
Expand Down Expand Up @@ -267,20 +268,25 @@ def test_cli_quiet(testdir):
infile = os.path.join(testdir, "empty.pdf")
outfile = os.path.join(tempdir, "empty.csv")
runner = CliRunner()

result = runner.invoke(
cli, ["--format", "csv", "--output", outfile, "stream", infile]
)
assert "Found 0 tables" in result.output

try:
result = runner.invoke(
cli,
["--quiet", "--format", "csv", "--output", outfile, "stream", infile],
)
except Warning as e:
warning_text = str(e)
pytest.fail(f"Unexpected warning: {warning_text}")
with warnings.catch_warnings():
# the test should fail if any warning is thrown
# warnings.simplefilter("error")
try:
result = runner.invoke(
cli,
[
"--quiet",
"--format",
"csv",
"--output",
outfile,
"stream",
infile,
],
)
except Warning as e:
warning_text = str(e)
pytest.fail(f"Unexpected warning: {warning_text}")


def test_cli_lattice_plot_type():
Expand Down

0 comments on commit 62b6cf3

Please sign in to comment.