From cd0e58e56195aa2fdd9be1495c6444d71fbc7dba Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 25 Jan 2022 11:07:10 +0100 Subject: [PATCH] python3Packages.woob: disable doctest and coverage --- .../python-modules/woob/default.nix | 49 ++++++++++------- .../woob/no-test-requiring-network.patch | 54 ------------------- 2 files changed, 31 insertions(+), 72 deletions(-) delete mode 100644 pkgs/development/python-modules/woob/no-test-requiring-network.patch diff --git a/pkgs/development/python-modules/woob/default.nix b/pkgs/development/python-modules/woob/default.nix index fc5e6e9dc65b..3c9529c2644b 100644 --- a/pkgs/development/python-modules/woob/default.nix +++ b/pkgs/development/python-modules/woob/default.nix @@ -1,12 +1,10 @@ { lib -, buildPythonPackage -, fetchPypi -, isPy27 , Babel +, buildPythonPackage , colorama , cssselect -, python-dateutil , feedparser +, fetchFromGitLab , gdata , gnupg , google-api-python-client @@ -19,6 +17,8 @@ , pillow , prettytable , pyqt5 +, python-dateutil +, pythonOlder , pyyaml , requests , simplejson @@ -29,22 +29,21 @@ buildPythonPackage rec { pname = "woob"; version = "3.0"; - disabled = isPy27; + format = "setuptools"; - src = fetchPypi { - inherit pname version; - sha256 = "09hpxy5zhn2b8li0xjf3zd7s46lawb0315p5mdcsci3bj3s4v1j7"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitLab { + owner = "woob"; + repo = pname; + rev = version; + hash = "sha256-XLcHNidclORbxVXgcsHY6Ja/dak+EVSKTaVQmg1f/rw="; }; - patches = [ - # Disable doctests that require networking: - ./no-test-requiring-network.patch + nativeBuildInputs = [ + pyqt5 ]; - checkInputs = [ nose ]; - - nativeBuildInputs = [ pyqt5 ]; - propagatedBuildInputs = [ Babel colorama @@ -69,14 +68,28 @@ buildPythonPackage rec { unidecode ]; + postPatch = '' + substituteInPlace setup.cfg \ + --replace "with-doctest = 1" "" \ + --replace "with-coverage = 1" "" + ''; + + checkInputs = [ + nose + ]; + checkPhase = '' nosetests ''; + pythonImportsCheck = [ + "woob" + ]; + meta = with lib; { + description = "Collection of applications and APIs to interact with websites"; homepage = "https://woob.tech"; - description = "Collection of applications and APIs to interact with websites without requiring the user to open a browser"; license = licenses.lgpl3Plus; - maintainers = [ maintainers.DamienCassou ]; - }; + maintainers = with maintainers; [ DamienCassou ]; + }; } diff --git a/pkgs/development/python-modules/woob/no-test-requiring-network.patch b/pkgs/development/python-modules/woob/no-test-requiring-network.patch deleted file mode 100644 index 7095019d0541..000000000000 --- a/pkgs/development/python-modules/woob/no-test-requiring-network.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/woob/browser/browsers.py -+++ b/woob/browser/browsers.py -@@ -930,23 +930,6 @@ - - :class:`NextPage` constructor can take an url or a Request object. - -- >>> from .pages import HTMLPage -- >>> class Page(HTMLPage): -- ... def iter_values(self): -- ... for el in self.doc.xpath('//li'): -- ... yield el.text -- ... for next in self.doc.xpath('//a'): -- ... raise NextPage(next.attrib['href']) -- ... -- >>> class Browser(PagesBrowser): -- ... BASEURL = 'https://woob.tech' -- ... list = URL('/tests/list-(?P\d+).html', Page) -- ... -- >>> b = Browser() -- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS -- -- >>> list(b.pagination(lambda: b.page.iter_values())) -- ['One', 'Two', 'Three', 'Four'] - """ - while True: - try: ---- a/woob/browser/pages.py -+++ b/woob/browser/pages.py -@@ -49,25 +49,6 @@ - - :class:`NextPage` constructor can take an url or a Request object. - -- >>> class Page(HTMLPage): -- ... @pagination -- ... def iter_values(self): -- ... for el in self.doc.xpath('//li'): -- ... yield el.text -- ... for next in self.doc.xpath('//a'): -- ... raise NextPage(next.attrib['href']) -- ... -- >>> from .browsers import PagesBrowser -- >>> from .url import URL -- >>> class Browser(PagesBrowser): -- ... BASEURL = 'https://woob.tech' -- ... list = URL('/tests/list-(?P\d+).html', Page) -- ... -- >>> b = Browser() -- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS -- -- >>> list(b.page.iter_values()) -- ['One', 'Two', 'Three', 'Four'] - """ - - @wraps(func)