diff --git a/camelot/parsers/lattice.py b/camelot/parsers/lattice.py index 13d1d61..9687ee8 100644 --- a/camelot/parsers/lattice.py +++ b/camelot/parsers/lattice.py @@ -142,9 +142,10 @@ class Lattice(BaseParser): if isinstance(backend, str): if backend in BACKENDS.keys(): if backend == "ghostscript": - raise DeprecationWarning( + warnings.warn( "'ghostscript' will be replaced by 'poppler' as the default image conversion" - " backend in v0.12.0. You can try out 'poppler' with backend='poppler'." + " backend in v0.12.0. You can try out 'poppler' with backend='poppler'.", + DeprecationWarning ) return BACKENDS[backend]() diff --git a/tests/test_cli.py b/tests/test_cli.py index 5ae7980..70b5b7b 100755 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- import os +import sys +import pytest from click.testing import CliRunner from camelot.cli import cli @@ -11,7 +13,10 @@ from camelot.utils import TemporaryDirectory testdir = os.path.dirname(os.path.abspath(__file__)) testdir = os.path.join(testdir, "files") -skip_on_windows = pytest.mark.skip(sys.platform.startswith("win")) +skip_on_windows = pytest.mark.skipif( + sys.platform.startswith("win"), + reason="Ghostscript not installed in Windows test environment", +) def test_help_output(): @@ -38,7 +43,7 @@ def test_cli_lattice(): cli, ["--format", "csv", "--output", outfile, "lattice", infile] ) assert result.exit_code == 0 - assert result.output == "Found 1 tables\n" + assert "Found 1 tables" in result.output result = runner.invoke(cli, ["--format", "csv", "lattice", infile]) output_error = "Error: Please specify output file path using --output" diff --git a/tests/test_common.py b/tests/test_common.py index 0f33ebb..9e07efa 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -3,6 +3,7 @@ import os import sys +import pytest import pandas as pd from pandas.testing import assert_frame_equal @@ -16,7 +17,10 @@ from .data import * testdir = os.path.dirname(os.path.abspath(__file__)) testdir = os.path.join(testdir, "files") -skip_on_windows = pytest.mark.skip(sys.platform.startswith("win")) +skip_on_windows = pytest.mark.skipif( + sys.platform.startswith("win"), + reason="Ghostscript not installed in Windows test environment", +) def test_version_generation(): diff --git a/tests/test_errors.py b/tests/test_errors.py index 5a37112..1cdb344 100755 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import sys import warnings import pytest @@ -12,7 +13,10 @@ testdir = os.path.dirname(os.path.abspath(__file__)) testdir = os.path.join(testdir, "files") filename = os.path.join(testdir, "foo.pdf") -skip_on_windows = pytest.mark.skip(sys.platform.startswith("win")) +skip_on_windows = pytest.mark.skipif( + sys.platform.startswith("win"), + reason="Ghostscript not installed in Windows test environment", +) def test_unknown_flavor(): @@ -87,7 +91,7 @@ def test_stream_equal_length(): def test_image_warning(): filename = os.path.join(testdir, "image.pdf") with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error", category=UserWarning) with pytest.raises(UserWarning) as e: tables = camelot.read_pdf(filename) assert ( @@ -117,7 +121,7 @@ def test_stream_no_tables_in_area(): def test_lattice_no_tables_on_page(): filename = os.path.join(testdir, "empty.pdf") with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error", category=UserWarning) with pytest.raises(UserWarning) as e: tables = camelot.read_pdf(filename, flavor="lattice") assert str(e.value) == "No tables found on page-1" diff --git a/tests/test_lattice.py b/tests/test_lattice.py index edd0966..7636b1b 100644 --- a/tests/test_lattice.py +++ b/tests/test_lattice.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- import os +import sys +import pytest import pandas as pd from pandas.testing import assert_frame_equal @@ -14,7 +16,10 @@ from .data import * testdir = os.path.dirname(os.path.abspath(__file__)) testdir = os.path.join(testdir, "files") -skip_on_windows = pytest.mark.skip(sys.platform.startswith("win")) +skip_on_windows = pytest.mark.skipif( + sys.platform.startswith("win"), + reason="Ghostscript not installed in Windows test environment", +) @skip_on_windows diff --git a/tests/test_plotting.py b/tests/test_plotting.py index d38fbad..071dfff 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -10,7 +10,10 @@ import camelot testdir = os.path.dirname(os.path.abspath(__file__)) testdir = os.path.join(testdir, "files") -skip_on_windows = pytest.mark.skip(sys.platform.startswith("win")) +skip_on_windows = pytest.mark.skipif( + sys.platform.startswith("win"), + reason="Ghostscript not installed in Windows test environment", +) @skip_on_windows diff --git a/tests/test_stream.py b/tests/test_stream.py index 4a0ec0c..0626ea7 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -2,6 +2,7 @@ import os +import pytest import pandas as pd from pandas.testing import assert_frame_equal