Merge pull request #246 from camelot-dev/use-explicit-backends

Use PopplerBackend and GhostscriptBackend in test_plotting.py
This commit is contained in:
Vinayak Mehta
2021-07-06 03:06:50 +05:30
committed by GitHub
+10 -9
View File
@@ -6,7 +6,8 @@ import sys
import pytest
import camelot
from camelot.backends.image_conversion import ImageConversionBackend
from camelot.backends.poppler_backend import PopplerBackend
from camelot.backends.ghostscript_backend import GhostscriptBackend
testdir = os.path.dirname(os.path.abspath(__file__))
@@ -30,7 +31,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, backend=ImageConversionBackend("poppler", use_fallback=False))
tables = camelot.read_pdf(filename, backend=PopplerBackend())
return camelot.plot(tables[0], kind="contour")
@@ -40,7 +41,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", use_fallback=False))
tables = camelot.read_pdf(filename, backend=GhostscriptBackend())
return camelot.plot(tables[0], kind="contour")
@@ -54,7 +55,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, backend=ImageConversionBackend("poppler", use_fallback=False))
tables = camelot.read_pdf(filename, backend=PopplerBackend())
return camelot.plot(tables[0], kind="line")
@@ -64,14 +65,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", use_fallback=False))
tables = camelot.read_pdf(filename, backend=GhostscriptBackend())
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, backend=ImageConversionBackend("poppler", use_fallback=False))
tables = camelot.read_pdf(filename, backend=PopplerBackend())
return camelot.plot(tables[0], kind="joint")
@@ -81,14 +82,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", use_fallback=False))
tables = camelot.read_pdf(filename, backend=GhostscriptBackend())
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, backend=ImageConversionBackend("poppler", use_fallback=False))
tables = camelot.read_pdf(filename, backend=PopplerBackend())
return camelot.plot(tables[0], kind="grid")
@@ -98,5 +99,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", use_fallback=False))
tables = camelot.read_pdf(filename, backend=GhostscriptBackend())
return camelot.plot(tables[0], kind="grid")