From 458181cd1dbdf64a0f1af0ea005d2f302560447b Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Sun, 4 Jul 2021 20:22:32 +0530 Subject: [PATCH] Don't use fallback for image conversion backend tests --- tests/test_common.py | 51 +++++++++++++++++++++++++++++++----------- tests/test_plotting.py | 16 ++++++------- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/tests/test_common.py b/tests/test_common.py index 4ffd302..86889d5 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -53,7 +53,9 @@ def test_password(): def test_repr_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename) + tables = camelot.read_pdf( + filename, backend=ImageConversionBackend(backend="poppler", use_fallback=False) + ) assert repr(tables) == "" assert repr(tables[0]) == "" assert repr(tables[0].cells[0][0]) == "" @@ -65,7 +67,8 @@ def test_repr_ghostscript(): filename = os.path.join(testdir, "foo.pdf") tables = camelot.read_pdf( - filename, backend=ImageConversionBackend(backend="ghostscript") + filename, + backend=ImageConversionBackend(backend="ghostscript", use_fallback=False), ) assert repr(tables) == "" assert repr(tables[0]) == "
" @@ -74,7 +77,9 @@ def test_repr_ghostscript(): def test_url_poppler(): url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf" - tables = camelot.read_pdf(url) + tables = camelot.read_pdf( + url, backend=ImageConversionBackend(backend="poppler", use_fallback=False) + ) assert repr(tables) == "" assert repr(tables[0]) == "
" assert repr(tables[0].cells[0][0]) == "" @@ -86,7 +91,7 @@ def test_url_ghostscript(): url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf" tables = camelot.read_pdf( - url, backend=ImageConversionBackend(backend="ghostscript") + url, backend=ImageConversionBackend(backend="ghostscript", use_fallback=False) ) assert repr(tables) == "" assert repr(tables[0]) == "
" @@ -95,17 +100,27 @@ def test_url_ghostscript(): def test_pages_poppler(): url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf" - tables = camelot.read_pdf(url) + tables = camelot.read_pdf( + url, backend=ImageConversionBackend(backend="poppler", use_fallback=False) + ) assert repr(tables) == "" assert repr(tables[0]) == "
" assert repr(tables[0].cells[0][0]) == "" - tables = camelot.read_pdf(url, pages="1-end") + tables = camelot.read_pdf( + url, + pages="1-end", + backend=ImageConversionBackend(backend="poppler", use_fallback=False), + ) assert repr(tables) == "" assert repr(tables[0]) == "
" assert repr(tables[0].cells[0][0]) == "" - tables = camelot.read_pdf(url, pages="all") + tables = camelot.read_pdf( + url, + pages="all", + backend=ImageConversionBackend(backend="poppler", use_fallback=False), + ) assert repr(tables) == "" assert repr(tables[0]) == "
" assert repr(tables[0].cells[0][0]) == "" @@ -116,20 +131,30 @@ def test_pages_ghostscript(): return True url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf" - tables = camelot.read_pdf(url) + tables = camelot.read_pdf( + url, backend=ImageConversionBackend(backend="ghostscript", use_fallback=False) + ) assert repr(tables) == "" assert repr(tables[0]) == "
" - assert repr(tables[0].cells[0][0]) == "" + assert repr(tables[0].cells[0][0]) == "" - tables = camelot.read_pdf(url, pages="1-end") + tables = camelot.read_pdf( + url, + pages="1-end", + backend=ImageConversionBackend(backend="ghostscript", use_fallback=False), + ) assert repr(tables) == "" assert repr(tables[0]) == "
" - assert repr(tables[0].cells[0][0]) == "" + assert repr(tables[0].cells[0][0]) == "" - tables = camelot.read_pdf(url, pages="all") + tables = camelot.read_pdf( + url, + pages="all", + backend=ImageConversionBackend(backend="ghostscript", use_fallback=False), + ) assert repr(tables) == "" assert repr(tables[0]) == "
" - assert repr(tables[0].cells[0][0]) == "" + assert repr(tables[0].cells[0][0]) == "" def test_table_order(): diff --git a/tests/test_plotting.py b/tests/test_plotting.py index e13fc98..5be7a48 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -30,7 +30,7 @@ def test_textedge_plot(): @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_lattice_contour_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) return camelot.plot(tables[0], kind="contour") @@ -40,7 +40,7 @@ def test_lattice_contour_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript")) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) return camelot.plot(tables[0], kind="contour") @@ -54,7 +54,7 @@ def test_stream_contour_plot(): @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_line_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) return camelot.plot(tables[0], kind="line") @@ -64,14 +64,14 @@ def test_line_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript")) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) return camelot.plot(tables[0], kind="line") @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_joint_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) return camelot.plot(tables[0], kind="joint") @@ -81,14 +81,14 @@ def test_joint_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript")) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) return camelot.plot(tables[0], kind="joint") @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_grid_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) return camelot.plot(tables[0], kind="grid") @@ -98,5 +98,5 @@ def test_grid_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript")) + tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) return camelot.plot(tables[0], kind="grid")