Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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.

(cherry picked from commit d8019d3d27dc901ba98921cbeaf2dc09e71c1349)

authored by

Martin Weinelt and committed by
Vladimír Čunát
4897ef23 b1241e64

+23
+7
pkgs/development/python-modules/pycodestyle/default.nix
··· 18 hash = "sha256-NHGHvbR2Mp2Y9pXCE9cpWoRtEVL/T+m6y4qVkLjucFM="; 19 }; 20 21 # https://github.com/PyCQA/pycodestyle/blob/2.10.0/tox.ini#L13 22 checkPhase = '' 23 ${python.interpreter} -m pycodestyle --statistics pycodestyle.py
··· 18 hash = "sha256-NHGHvbR2Mp2Y9pXCE9cpWoRtEVL/T+m6y4qVkLjucFM="; 19 }; 20 21 + patches = [ 22 + # https://github.com/PyCQA/pycodestyle/issues/1151 23 + # Applies a modified version of an upstream patch that only applied 24 + # to Python 3.12. 25 + ./python-3.11.4-compat.patch 26 + ]; 27 + 28 # https://github.com/PyCQA/pycodestyle/blob/2.10.0/tox.ini#L13 29 checkPhase = '' 30 ${python.interpreter} -m pycodestyle --statistics pycodestyle.py
+16
pkgs/development/python-modules/pycodestyle/python-3.11.4-compat.patch
···
··· 1 + diff --git a/testsuite/test_api.py b/testsuite/test_api.py 2 + index 8dde32ff..38e34acf 100644 3 + --- a/testsuite/test_api.py 4 + +++ b/testsuite/test_api.py 5 + @@ -329,7 +329,10 @@ def test_check_nullbytes(self): 6 + count_errors = pep8style.input_file('stdin', lines=['\x00\n']) 7 + 8 + stdout = sys.stdout.getvalue() 9 + - expected = "stdin:1:1: E901 ValueError" 10 + + if sys.version_info < (3, 11, 4): 11 + + expected = "stdin:1:1: E901 ValueError" 12 + + else: 13 + + expected = "stdin:1:1: E901 SyntaxError: source code string cannot contain null bytes" # noqa: E501 14 + self.assertTrue(stdout.startswith(expected), 15 + msg='Output %r does not start with %r' % 16 + (stdout, expected))