Commit 5ed29324 authored by mana-byte's avatar mana-byte
Browse files

python3Packages.camelot: enabled tests

parent ef84171b
Loading
Loading
Loading
Loading
+41 −16
Original line number Diff line number Diff line
{
  lib,
  pkgs,
  fetchFromGitHub,
  buildPythonPackage,

  # build system
  setuptools,

  # dependencies
  chardet,
  charset-normalizer,
  click,
  fetchPypi,
  lib,
  numpy,
  opencv-python-headless,
  openpyxl,
  pandas,
  pdfminer-six,
  pillow,
  pkgs,
  pypdf,
  pypdfium2,
  setuptools,
  tabulate,
}:

buildPythonPackage rec {
  # tests
  pytestCheckHook,
  matplotlib,
}:
buildPythonPackage (finalAttrs: {
  pname = "camelot-py";
  version = "1.0.9";
  pyproject = true;

  src = fetchPypi {
    pname = "camelot_py";
    inherit version;
    hash = "sha256-1D2Idm98NGKAP/EUZOfT0VqSI+hFly3ith73w/YtMgA=";
  src = fetchFromGitHub {
    owner = "camelot-dev";
    repo = "camelot";
    tag = "v${finalAttrs.version}";
    sha256 = "sha256-msf49Vt0IlwUNTvLIqTWKlMfcFB0LnvGGf7vReqhJec=";
  };

  patches = [ ./ghostscript.patch ];
@@ -40,9 +48,8 @@ buildPythonPackage rec {
  build-system = [ setuptools ];

  dependencies = [
    chardet
    charset-normalizer
    click
    numpy
    opencv-python-headless
    openpyxl
    pandas
@@ -51,9 +58,27 @@ buildPythonPackage rec {
    pypdf
    pypdfium2
    tabulate
    # Dependency not present in project's pyproject.toml, but doesn't build without it
    chardet
  ];

  doCheck = false;
  nativeCheckInputs = [
    pytestCheckHook
    matplotlib
  ];
  disabledTests = [
    # Assertion Error: <Cell cords> != <Cell other_cords>
    "test_repr_ghostscript"
    # cv2.error: color.cpp failure
    "test_repr_ghostscript_custom_backend"
    # urllib.error.URLError: temporary failure in name
    "test_url_pdfium"
    "test_url_ghostscript"
    "test_url_ghost_script_custom_backend"
    "test_pages_pdfium"
    "test_pages_ghostscript"
    "test_pages_ghostscript_custom_backend"
  ];

  pythonImportsCheck = [ "camelot" ];

@@ -61,8 +86,8 @@ buildPythonPackage rec {
    description = "Python library to extract tabular data from PDFs";
    mainProgram = "camelot";
    homepage = "http://camelot-py.readthedocs.io";
    changelog = "https://github.com/camelot-dev/camelot/blob/v${version}/HISTORY.md";
    changelog = "https://github.com/camelot-dev/camelot/blob/${finalAttrs.src.tag}/HISTORY.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ _2gn ];
  };
}
})