From d8019d3d27dc901ba98921cbeaf2dc09e71c1349 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 15 Jun 2023 23:30:21 +0200 Subject: [PATCH] python311Packages.pycodestyle: Fix tests on python 3.11.4 Applies a modified version of upstreams patch to fix the tests, only upstream only recognized the issue from 3.12, while it hit us on 3.11.4. --- .../python-modules/pycodestyle/default.nix | 7 +++++++ .../pycodestyle/python-3.11.4-compat.patch | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/development/python-modules/pycodestyle/python-3.11.4-compat.patch diff --git a/pkgs/development/python-modules/pycodestyle/default.nix b/pkgs/development/python-modules/pycodestyle/default.nix index ed4ac3f5fbf37..cdbec27700806 100644 --- a/pkgs/development/python-modules/pycodestyle/default.nix +++ b/pkgs/development/python-modules/pycodestyle/default.nix @@ -18,6 +18,13 @@ buildPythonPackage rec { hash = "sha256-NHGHvbR2Mp2Y9pXCE9cpWoRtEVL/T+m6y4qVkLjucFM="; }; + patches = [ + # https://github.com/PyCQA/pycodestyle/issues/1151 + # Applies a modified version of an upstream patch that only applied + # to Python 3.12. + ./python-3.11.4-compat.patch + ]; + # https://github.com/PyCQA/pycodestyle/blob/2.10.0/tox.ini#L13 checkPhase = '' ${python.interpreter} -m pycodestyle --statistics pycodestyle.py diff --git a/pkgs/development/python-modules/pycodestyle/python-3.11.4-compat.patch b/pkgs/development/python-modules/pycodestyle/python-3.11.4-compat.patch new file mode 100644 index 0000000000000..d8a0d7953776d --- /dev/null +++ b/pkgs/development/python-modules/pycodestyle/python-3.11.4-compat.patch @@ -0,0 +1,16 @@ +diff --git a/testsuite/test_api.py b/testsuite/test_api.py +index 8dde32ff..38e34acf 100644 +--- a/testsuite/test_api.py ++++ b/testsuite/test_api.py +@@ -329,7 +329,10 @@ def test_check_nullbytes(self): + count_errors = pep8style.input_file('stdin', lines=['\x00\n']) + + stdout = sys.stdout.getvalue() +- expected = "stdin:1:1: E901 ValueError" ++ if sys.version_info < (3, 11, 4): ++ expected = "stdin:1:1: E901 ValueError" ++ else: ++ expected = "stdin:1:1: E901 SyntaxError: source code string cannot contain null bytes" # noqa: E501 + self.assertTrue(stdout.startswith(expected), + msg='Output %r does not start with %r' % + (stdout, expected))