Fix plotting unit tests impacted by MatplotLib
parent
f54e1563e1
commit
52e67a7f7c
|
|
@ -2369,7 +2369,8 @@ data_lattice_table_rotated = [
|
||||||
["Madhya Pradesh", "*", "*", "*", "7942", "470", "1965", "2150", "1579", "1709"],
|
["Madhya Pradesh", "*", "*", "*", "7942", "470", "1965", "2150", "1579", "1709"],
|
||||||
["Orissa", "3756", "5540", "12024", "8473", "398", "2040", "2624", "1093", "1628"],
|
["Orissa", "3756", "5540", "12024", "8473", "398", "2040", "2624", "1093", "1628"],
|
||||||
["West Bengal", "*", "*", "*", "8047", "423", "2058", "2743", "1413", "2027"],
|
["West Bengal", "*", "*", "*", "8047", "423", "2058", "2743", "1413", "2027"],
|
||||||
["Uttar Pradesh", "*", "*", "*", "9860", "581", "2139", "2415", "1185", "1366"],
|
["Uttar Pradesh", "*", "*", "*", "9860", "581", "2139", "2415", "1185",
|
||||||
|
"1366"],
|
||||||
[
|
[
|
||||||
"Pooled",
|
"Pooled",
|
||||||
"38742",
|
"38742",
|
||||||
|
|
|
||||||
|
|
@ -4,29 +4,29 @@ import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import pdfminer
|
import matplotlib
|
||||||
|
|
||||||
import camelot
|
import camelot
|
||||||
|
|
||||||
# The version of PDFMiner has an impact on some of the tests. Unfortunately,
|
# The version of Matplotlib has an impact on some of the tests. Unfortunately,
|
||||||
# we can't enforce usage of a recent version of PDFMiner without dropping
|
# we can't enforce usage of a recent version of MatplotLib without dropping
|
||||||
# support for Python 2.
|
# support for Python 3.6.
|
||||||
# To check the version of pdfminer.six installed:
|
# To check the version of matplotlib installed:
|
||||||
# pip freeze | grep pdfminer.six
|
# pip freeze | grep matplotlib
|
||||||
# To force upgrade:
|
# To force upgrade:
|
||||||
# pip install --upgrade --force-reinstall pdfminer.six
|
# pip install --upgrade --force-reinstall matplotlib
|
||||||
# To force usage of a Python 2 compatible version:
|
# To force usage of a Python 3.6 compatible version:
|
||||||
# pip install "pdfminer.six==20191110"
|
# pip install "matplotlib==2.2.5"
|
||||||
# This condition can be removed in favor of a version requirement bump for
|
# This condition can be removed in favor of a version requirement bump for
|
||||||
# pdfminer.six once support for Python 2 is dropped.
|
# matplotlib once support for Python 3.5 is dropped.
|
||||||
|
|
||||||
LEGACY_PDF_MINER = pdfminer.__version__ < "20200402"
|
LEGACY_MATPLOTLIB = matplotlib.__version__ < "3.2.1"
|
||||||
|
|
||||||
testdir = os.path.dirname(os.path.abspath(__file__))
|
testdir = os.path.dirname(os.path.abspath(__file__))
|
||||||
testdir = os.path.join(testdir, "files")
|
testdir = os.path.join(testdir, "files")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(LEGACY_PDF_MINER,
|
@pytest.mark.skipif(LEGACY_MATPLOTLIB,
|
||||||
reason="depends on a recent version of PDFMiner")
|
reason="depends on a recent version of PDFMiner")
|
||||||
@pytest.mark.mpl_image_compare(
|
@pytest.mark.mpl_image_compare(
|
||||||
baseline_dir="files/baseline_plots", remove_text=True)
|
baseline_dir="files/baseline_plots", remove_text=True)
|
||||||
|
|
@ -52,7 +52,7 @@ def test_lattice_contour_plot():
|
||||||
return camelot.plot(tables[0], kind='contour')
|
return camelot.plot(tables[0], kind='contour')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(LEGACY_PDF_MINER,
|
@pytest.mark.skipif(LEGACY_MATPLOTLIB,
|
||||||
reason="depends on a recent version of PDFMiner")
|
reason="depends on a recent version of PDFMiner")
|
||||||
@pytest.mark.mpl_image_compare(
|
@pytest.mark.mpl_image_compare(
|
||||||
baseline_dir="files/baseline_plots", remove_text=True)
|
baseline_dir="files/baseline_plots", remove_text=True)
|
||||||
|
|
@ -70,6 +70,8 @@ def test_line_plot():
|
||||||
return camelot.plot(tables[0], kind='line')
|
return camelot.plot(tables[0], kind='line')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(LEGACY_MATPLOTLIB,
|
||||||
|
reason="depends on a recent version of PDFMiner")
|
||||||
@pytest.mark.mpl_image_compare(
|
@pytest.mark.mpl_image_compare(
|
||||||
baseline_dir="files/baseline_plots", remove_text=True)
|
baseline_dir="files/baseline_plots", remove_text=True)
|
||||||
def test_joint_plot():
|
def test_joint_plot():
|
||||||
|
|
@ -78,7 +80,7 @@ def test_joint_plot():
|
||||||
return camelot.plot(tables[0], kind='joint')
|
return camelot.plot(tables[0], kind='joint')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(LEGACY_PDF_MINER,
|
@pytest.mark.skipif(LEGACY_MATPLOTLIB,
|
||||||
reason="depends on a recent version of PDFMiner")
|
reason="depends on a recent version of PDFMiner")
|
||||||
@pytest.mark.mpl_image_compare(
|
@pytest.mark.mpl_image_compare(
|
||||||
baseline_dir="files/baseline_plots", remove_text=True)
|
baseline_dir="files/baseline_plots", remove_text=True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue