From b06174986cc1128969c3fe5c8e7c86cf03963f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 10 Mar 2021 14:49:50 +0100 Subject: [PATCH] python3Packages.dateparser: run tests --- .../python-modules/dateparser/default.nix | 72 +++++++++---------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/pkgs/development/python-modules/dateparser/default.nix b/pkgs/development/python-modules/dateparser/default.nix index 6884c00988f0..21dcffc4a841 100644 --- a/pkgs/development/python-modules/dateparser/default.nix +++ b/pkgs/development/python-modules/dateparser/default.nix @@ -1,19 +1,17 @@ -{ lib, fetchPypi, buildPythonPackage -, nose -, parameterized -, mock -, flake8 -, glibcLocales -, six -, jdatetime -, dateutil -, umalqurra -, pytz -, tzlocal -, regex -, ruamel_yaml -, python +{ lib +, buildPythonPackage , isPy3k +, fetchFromGitHub +, dateutil +, pytz +, regex +, tzlocal +, hijri-converter +, convertdate +, parameterized +, pytestCheckHook +, GitPython +, ruamel_yaml }: buildPythonPackage rec { @@ -22,42 +20,36 @@ buildPythonPackage rec { disabled = !isPy3k; - src = fetchPypi { - inherit pname version; - sha256 = "159cc4e01a593706a15cd4e269a0b3345edf3aef8bf9278a57dac8adf5bf1e4a"; + src = fetchFromGitHub { + owner = "scrapinghub"; + repo = "dateparser"; + rev = "v${version}"; + sha256 = "0i6ci14lqfsqrmaif57dyilrjbxzmbl98hps1b565gkiy1xqmjhl"; }; - checkInputs = [ - flake8 - nose - mock - parameterized - six - glibcLocales - ]; - preCheck ='' - # skip because of missing convertdate module, which is an extra requirement - rm tests/test_jalali.py - ''; - - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; - - # Strange - # AttributeError: 'module' object has no attribute 'config' - doCheck = false; - propagatedBuildInputs = [ # install_requires dateutil pytz regex tzlocal # extra_requires - jdatetime ruamel_yaml umalqurra + hijri-converter convertdate ]; + checkInputs = [ + parameterized + pytestCheckHook + GitPython + ruamel_yaml + ]; + + # Upstream only runs the tests in tests/ in CI, others use git clone + pytestFlagsArray = [ "tests" ]; + + pythonImportsCheck = [ "dateparser" ]; + meta = with lib; { description = "Date parsing library designed to parse dates from HTML pages"; homepage = "https://github.com/scrapinghub/dateparser"; license = licenses.bsd3; + maintainers = with maintainers; [ dotlambda ]; }; }