From d08d54ced891825f0f42845c4d5bbffc3281f66a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 26 Nov 2021 22:32:32 +0100 Subject: [PATCH 1/3] python3Packages.pep8-naming: add patch to fix tests --- .../python-modules/pep8-naming/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/pep8-naming/default.nix b/pkgs/development/python-modules/pep8-naming/default.nix index 9bfdbe89aab6e..ce2b89ddb4f42 100644 --- a/pkgs/development/python-modules/pep8-naming/default.nix +++ b/pkgs/development/python-modules/pep8-naming/default.nix @@ -1,5 +1,6 @@ { lib , fetchPypi +, fetchpatch , buildPythonPackage , flake8 , flake8-polyfill @@ -20,6 +21,16 @@ buildPythonPackage rec { flake8-polyfill ]; + patches = [ + # Add missing option to get passing tests, https://github.com/PyCQA/pep8-naming/pull/181 + (fetchpatch { + name = "add-missing-option.patch"; + url = "https://github.com/PyCQA/pep8-naming/commit/03b8f36f6a8bb8bc79dfa5a71ad9be2a0bf8bbf5.patch"; + sha256 = "1YTh84Yoj0MqFZoifM362563r1GuzaF+mMmdT/ckC7I="; + }) + ]; + + checkPhase = '' runHook preCheck ${python.interpreter} run_tests.py From 82e26e0974a5541d3592cc446ee2d300c0291791 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 26 Nov 2021 22:59:45 +0100 Subject: [PATCH 2/3] python3Packages.pylint-django: disable failing tests --- .../python-modules/pylint-django/default.nix | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/pylint-django/default.nix b/pkgs/development/python-modules/pylint-django/default.nix index 701163bb3d0c2..c93c8d4207fe8 100644 --- a/pkgs/development/python-modules/pylint-django/default.nix +++ b/pkgs/development/python-modules/pylint-django/default.nix @@ -1,16 +1,12 @@ -{ buildPythonPackage +{ lib +, buildPythonPackage +, coverage +, django +, factory_boy , fetchFromGitHub , isPy3k -, lib - -# pythonPackages -, django , pylint-plugin-utils - -# pythonPackages for checkInputs -, coverage -, factory_boy -, pytest +, pytestCheckHook }: buildPythonPackage rec { @@ -30,17 +26,26 @@ buildPythonPackage rec { pylint-plugin-utils ]; - checkInputs = [ coverage factory_boy pytest ]; + checkInputs = [ + coverage + factory_boy + pytestCheckHook + ]; + + disabledTests = [ + # Skip outdated tests and the one with a missing dependency (django_tables2) + "external_django_tables2_noerror_meta_class" + "external_factory_boy_noerror" + "func_noerror_foreign_key_attributes" + "func_noerror_foreign_key_key_cls_unbound" + ]; - # Check command taken from scripts/test.sh - # Skip test external_django_tables2_noerror_meta_class: - # requires an unpackaged django_tables2 - checkPhase = '' - python pylint_django/tests/test_func.py -v -k "not tables2" - ''; + pythonImportsCheck = [ + "pylint_django" + ]; meta = with lib; { - description = "A Pylint plugin to analyze Django applications"; + description = "Pylint plugin to analyze Django applications"; homepage = "https://github.com/PyCQA/pylint-django"; license = licenses.gpl2Plus; maintainers = with maintainers; [ kamadorueda ]; From 8959f7b2110972fce5f5025517399f7297dad040 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 26 Nov 2021 23:26:00 +0100 Subject: [PATCH 3/3] python3Packages.flake8-polyfill: disable failing tests --- .../flake8-polyfill/default.nix | 37 +++++++++++++------ .../python-modules/pep8-naming/default.nix | 1 - 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/flake8-polyfill/default.nix b/pkgs/development/python-modules/flake8-polyfill/default.nix index 050a6d4f9c8a5..60ee3558d1d47 100644 --- a/pkgs/development/python-modules/flake8-polyfill/default.nix +++ b/pkgs/development/python-modules/flake8-polyfill/default.nix @@ -1,6 +1,12 @@ -{ lib, fetchPypi, buildPythonPackage +{ lib +, buildPythonPackage +, fetchpatch +, fetchPypi , flake8 -, mock, pep8, pytest }: +, mock +, pep8 +, pytestCheckHook +}: buildPythonPackage rec { pname = "flake8-polyfill"; @@ -11,12 +17,6 @@ buildPythonPackage rec { sha256 = "1nlf1mkqw856vi6782qcglqhaacb23khk9wkcgn55npnjxshhjz4"; }; - postPatch = '' - # Failed: [pytest] section in setup.cfg files is no longer supported, change to [tool:pytest] instead. - substituteInPlace setup.cfg \ - --replace pytest 'tool:pytest' - ''; - propagatedBuildInputs = [ flake8 ]; @@ -24,13 +24,28 @@ buildPythonPackage rec { checkInputs = [ mock pep8 - pytest + pytestCheckHook + ]; + + patches = [ + # Skip unnecessary tests on Flake8, https://github.com/PyCQA/pep8-naming/pull/181 + (fetchpatch { + name = "skip-tests.patch"; + url = "https://github.com/PyCQA/flake8-polyfill/commit/3cf414350e82ceb835ca2edbd5d5967d33e9ff35.patch"; + sha256 = "mElZafodq8dF3wLO/LOqwFb7eLMsPLlEjNSu5AWqets="; + }) ]; - checkPhase = '' - pytest tests + postPatch = '' + # Failed: [pytest] section in setup.cfg files is no longer supported, change to [tool:pytest] instead. + substituteInPlace setup.cfg \ + --replace pytest 'tool:pytest' ''; + pythonImportsCheck = [ + "flake8_polyfill" + ]; + meta = with lib; { homepage = "https://gitlab.com/pycqa/flake8-polyfill"; description = "Polyfill package for Flake8 plugins"; diff --git a/pkgs/development/python-modules/pep8-naming/default.nix b/pkgs/development/python-modules/pep8-naming/default.nix index ce2b89ddb4f42..ee8535d089aae 100644 --- a/pkgs/development/python-modules/pep8-naming/default.nix +++ b/pkgs/development/python-modules/pep8-naming/default.nix @@ -30,7 +30,6 @@ buildPythonPackage rec { }) ]; - checkPhase = '' runHook preCheck ${python.interpreter} run_tests.py