forked from pool/python-black
Compare commits
11 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| fd3f5314f8 | |||
| 00b5fcb8c1 | |||
| 67f07faedc | |||
| 12dbb9a243 | |||
| 4de8aee8eb | |||
| 2538c47b8f | |||
| 26ca7ee935 | |||
| cf2dc2d33c | |||
| 93edfe795b | |||
| b86d1b2a52 | |||
| 8494645af4 |
139
click-820.patch
139
click-820.patch
@@ -5,13 +5,37 @@ Date: Fri, 7 Feb 2025 17:05:43 +0100
|
|||||||
Subject: [PATCH 1/4] mix_stderr parameter was removed from click 8.2.0
|
Subject: [PATCH 1/4] mix_stderr parameter was removed from click 8.2.0
|
||||||
|
|
||||||
---
|
---
|
||||||
tests/test_black.py | 28 +++++++++++++++++-----------
|
tests/test_black.py | 2 +-
|
||||||
1 file changed, 17 insertions(+), 11 deletions(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
Index: black-25.1.0/tests/test_black.py
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
===================================================================
|
index 31bc34d4b89..8fa352e3d22 100644
|
||||||
--- black-25.1.0.orig/tests/test_black.py 2020-02-02 01:00:00.000000000 +0100
|
--- a/tests/test_black.py
|
||||||
+++ black-25.1.0/tests/test_black.py 2025-06-18 22:23:10.051582946 +0200
|
+++ b/tests/test_black.py
|
||||||
|
@@ -114,7 +114,7 @@ class BlackRunner(CliRunner):
|
||||||
|
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
- super().__init__(mix_stderr=False)
|
||||||
|
+ super().__init__()
|
||||||
|
|
||||||
|
|
||||||
|
def invokeBlack(
|
||||||
|
|
||||||
|
From a65eb895e13263dc700cfbf60db0376e15957c4e Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
|
||||||
|
<meggy.calabkova@gmail.com>
|
||||||
|
Date: Mon, 10 Feb 2025 11:12:17 +0100
|
||||||
|
Subject: [PATCH 2/4] make the call conditional on click version
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_black.py | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
|
index 8fa352e3d22..cbb5006d070 100644
|
||||||
|
--- a/tests/test_black.py
|
||||||
|
+++ b/tests/test_black.py
|
||||||
@@ -14,6 +14,7 @@
|
@@ -14,6 +14,7 @@
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from contextlib import contextmanager, redirect_stderr
|
from contextlib import contextmanager, redirect_stderr
|
||||||
@@ -20,27 +44,90 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path, WindowsPath
|
from pathlib import Path, WindowsPath
|
||||||
from platform import system
|
from platform import system
|
||||||
@@ -25,6 +26,7 @@
|
@@ -26,6 +27,7 @@
|
||||||
import pytest
|
|
||||||
from click import unstyle
|
from click import unstyle
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
+from packaging.version import Version
|
|
||||||
from pathspec import PathSpec
|
from pathspec import PathSpec
|
||||||
|
+from packaging.version import Version
|
||||||
|
|
||||||
import black
|
import black
|
||||||
@@ -114,7 +116,10 @@
|
import black.files
|
||||||
|
@@ -114,7 +116,10 @@ class BlackRunner(CliRunner):
|
||||||
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
|
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
- super().__init__(mix_stderr=False)
|
- super().__init__()
|
||||||
+ if Version(imp_version("click")) >= Version("8.2.0"):
|
+ if Version(imp_version('click')) >= Version('8.2.0'):
|
||||||
+ super().__init__()
|
+ super().__init__()
|
||||||
+ else:
|
+ else:
|
||||||
+ super().__init__(mix_stderr=False)
|
+ super().__init__(mix_stderr=False)
|
||||||
|
|
||||||
|
|
||||||
def invokeBlack(
|
def invokeBlack(
|
||||||
@@ -187,10 +192,10 @@
|
|
||||||
|
From bdc188f550709e40b86f97777465e4068c61c261 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "pre-commit-ci[bot]"
|
||||||
|
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
|
||||||
|
Date: Mon, 10 Feb 2025 11:02:28 +0000
|
||||||
|
Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks
|
||||||
|
|
||||||
|
for more information, see https://pre-commit.ci
|
||||||
|
---
|
||||||
|
tests/test_black.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
|
index cbb5006d070..9870cec4c26 100644
|
||||||
|
--- a/tests/test_black.py
|
||||||
|
+++ b/tests/test_black.py
|
||||||
|
@@ -26,8 +26,8 @@
|
||||||
|
import pytest
|
||||||
|
from click import unstyle
|
||||||
|
from click.testing import CliRunner
|
||||||
|
-from pathspec import PathSpec
|
||||||
|
from packaging.version import Version
|
||||||
|
+from pathspec import PathSpec
|
||||||
|
|
||||||
|
import black
|
||||||
|
import black.files
|
||||||
|
|
||||||
|
From 3dfacb5f34476b8c1ff28b5eb05cb85ff7418a66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: MeggyCal <MeggyCal@users.noreply.github.com>
|
||||||
|
Date: Mon, 17 Feb 2025 12:01:26 +0100
|
||||||
|
Subject: [PATCH 4/4] double quotes
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_black.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
|
index 9870cec4c26..4bdbdbba5cf 100644
|
||||||
|
--- a/tests/test_black.py
|
||||||
|
+++ b/tests/test_black.py
|
||||||
|
@@ -116,7 +116,7 @@ class BlackRunner(CliRunner):
|
||||||
|
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
- if Version(imp_version('click')) >= Version('8.2.0'):
|
||||||
|
+ if Version(imp_version("click")) >= Version("8.2.0"):
|
||||||
|
super().__init__()
|
||||||
|
else:
|
||||||
|
super().__init__(mix_stderr=False)
|
||||||
|
|
||||||
|
From 17101f151b407cb3346b0a472d9e32d7a56d5aca Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Michael R. Crusoe" <michael.crusoe@gmail.com>
|
||||||
|
Date: Thu, 27 Feb 2025 15:17:21 +0100
|
||||||
|
Subject: [PATCH] additional fix for click 8.2.0
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_black.py | 18 +++++++++---------
|
||||||
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
|
index 4bdbdbba5cf..ca19c17678b 100644
|
||||||
|
--- a/tests/test_black.py
|
||||||
|
+++ b/tests/test_black.py
|
||||||
|
@@ -192,10 +192,10 @@ def test_piping(self) -> None:
|
||||||
input=BytesIO(source.encode("utf-8")),
|
input=BytesIO(source.encode("utf-8")),
|
||||||
)
|
)
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
@@ -55,7 +142,7 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
|
|
||||||
def test_piping_diff(self) -> None:
|
def test_piping_diff(self) -> None:
|
||||||
diff_header = re.compile(
|
diff_header = re.compile(
|
||||||
@@ -210,7 +215,7 @@
|
@@ -215,7 +215,7 @@ def test_piping_diff(self) -> None:
|
||||||
black.main, args, input=BytesIO(source.encode("utf-8"))
|
black.main, args, input=BytesIO(source.encode("utf-8"))
|
||||||
)
|
)
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
@@ -64,7 +151,7 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
actual = actual.rstrip() + "\n" # the diff output has a trailing space
|
actual = actual.rstrip() + "\n" # the diff output has a trailing space
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
@@ -295,7 +300,7 @@
|
@@ -300,7 +300,7 @@ def test_expression_diff(self) -> None:
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmp_file)
|
os.unlink(tmp_file)
|
||||||
@@ -73,7 +160,7 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
||||||
if expected != actual:
|
if expected != actual:
|
||||||
dump = black.dump_to_file(actual)
|
dump = black.dump_to_file(actual)
|
||||||
@@ -404,7 +409,7 @@
|
@@ -409,7 +409,7 @@ def test_skip_magic_trailing_comma(self) -> None:
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmp_file)
|
os.unlink(tmp_file)
|
||||||
@@ -82,7 +169,7 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
||||||
actual = actual.rstrip() + "\n" # the diff output has a trailing space
|
actual = actual.rstrip() + "\n" # the diff output has a trailing space
|
||||||
if expected != actual:
|
if expected != actual:
|
||||||
@@ -1826,7 +1831,7 @@
|
@@ -1831,7 +1831,7 @@ def test_bpo_2142_workaround(self) -> None:
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmp_file)
|
os.unlink(tmp_file)
|
||||||
@@ -91,7 +178,7 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
@@ -1836,7 +1841,7 @@
|
@@ -1841,7 +1841,7 @@ def compare_results(
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Helper method to test the value and exit code of a click Result."""
|
"""Helper method to test the value and exit code of a click Result."""
|
||||||
assert (
|
assert (
|
||||||
@@ -100,7 +187,21 @@ Index: black-25.1.0/tests/test_black.py
|
|||||||
), "The output did not match the expected value."
|
), "The output did not match the expected value."
|
||||||
assert result.exit_code == expected_exit_code, "The exit code is incorrect."
|
assert result.exit_code == expected_exit_code, "The exit code is incorrect."
|
||||||
|
|
||||||
@@ -1913,7 +1918,8 @@
|
|
||||||
|
From 7cf419741ab55028519f43524c3414a759aaa984 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
|
||||||
|
Date: Mon, 12 May 2025 13:49:11 +0200
|
||||||
|
Subject: [PATCH] Update test_code_option_safe to work with click 8.2.0
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_black.py | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_black.py b/tests/test_black.py
|
||||||
|
index acafb521619..f5c950244ef 100644
|
||||||
|
--- a/tests/test_black.py
|
||||||
|
+++ b/tests/test_black.py
|
||||||
|
@@ -1907,7 +1907,8 @@ def test_code_option_safe(self) -> None:
|
||||||
args = ["--safe", "--code", code]
|
args = ["--safe", "--code", code]
|
||||||
result = CliRunner().invoke(black.main, args)
|
result = CliRunner().invoke(black.main, args)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Wed Jun 18 20:26:19 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
|
||||||
|
|
||||||
- Instead of skipping the test, apply upstream fix as
|
|
||||||
update-PEP-701.patch (code from gh#psf/black!4690).
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 18 07:27:52 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
Wed Jun 18 07:27:52 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ URL: https://github.com/psf/black
|
|||||||
Source: https://files.pythonhosted.org/packages/source/b/black/black-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/b/black/black-%{version}.tar.gz
|
||||||
# PATCH-FIX-UPSTREAM click-820.patch gh#psf/black#4577, gh#psf/black#4591, gh#psf/black#4666
|
# PATCH-FIX-UPSTREAM click-820.patch gh#psf/black#4577, gh#psf/black#4591, gh#psf/black#4666
|
||||||
Patch0: click-820.patch
|
Patch0: click-820.patch
|
||||||
# PATCH-FIX-UPSTREAM update-PEP-701.patch gh#psf/black#4698 mcepl@suse.com
|
|
||||||
# Fix f-string format spec test failure
|
|
||||||
Patch1: update-PEP-701.patch
|
|
||||||
BuildRequires: %{python_module aiohttp >= 3.3.2}
|
BuildRequires: %{python_module aiohttp >= 3.3.2}
|
||||||
BuildRequires: %{python_module base >= 3.8}
|
BuildRequires: %{python_module base >= 3.8}
|
||||||
BuildRequires: %{python_module click >= 8.0.0}
|
BuildRequires: %{python_module click >= 8.0.0}
|
||||||
@@ -99,7 +96,9 @@ export PATH=$PATH:~/bin
|
|||||||
# test_expression_diff - sometimes fails on async timing in OBS
|
# test_expression_diff - sometimes fails on async timing in OBS
|
||||||
# test_bpo_2142_workaround fails on arm
|
# test_bpo_2142_workaround fails on arm
|
||||||
skiptests="test_expression_diff or test_bpo_2142_workaround"
|
skiptests="test_expression_diff or test_bpo_2142_workaround"
|
||||||
%pytest
|
# gh#psf/black#4698
|
||||||
|
skiptests+=" or test_simple_format"
|
||||||
|
%pytest -k "not ($skiptests)"
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
# If libalternatives is used: Removing old update-alternatives entries.
|
# If libalternatives is used: Removing old update-alternatives entries.
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
From ea716905a9d784734aa3f561a01f3447aaecd2ea Mon Sep 17 00:00:00 2001
|
|
||||||
From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com>
|
|
||||||
Date: Wed, 11 Jun 2025 10:50:20 -0700
|
|
||||||
Subject: [PATCH] Update pep_701.py
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/data/cases/pep_701.py | 8 ++++----
|
|
||||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
Index: black-25.1.0/tests/data/cases/pep_701.py
|
|
||||||
===================================================================
|
|
||||||
--- black-25.1.0.orig/tests/data/cases/pep_701.py 2020-02-02 01:00:00.000000000 +0100
|
|
||||||
+++ black-25.1.0/tests/data/cases/pep_701.py 2025-06-18 22:23:12.605019361 +0200
|
|
||||||
@@ -74,9 +74,9 @@
|
|
||||||
x = f"a{2+2:=^{foo(x+y**2):something else}one more}b"
|
|
||||||
f'{(abc:=10)}'
|
|
||||||
|
|
||||||
-f"This is a really long string, but just make sure that you reflow fstrings {
|
|
||||||
+f"""This is a really long string, but just make sure that you reflow fstrings {
|
|
||||||
2+2:d
|
|
||||||
-}"
|
|
||||||
+}"""
|
|
||||||
f"This is a really long string, but just make sure that you reflow fstrings correctly {2+2:d}"
|
|
||||||
|
|
||||||
f"{2+2=}"
|
|
||||||
@@ -213,9 +213,9 @@
|
|
||||||
x = f"a{2+2:=^{foo(x+y**2):something else}one more}b"
|
|
||||||
f"{(abc:=10)}"
|
|
||||||
|
|
||||||
-f"This is a really long string, but just make sure that you reflow fstrings {
|
|
||||||
+f"""This is a really long string, but just make sure that you reflow fstrings {
|
|
||||||
2+2:d
|
|
||||||
-}"
|
|
||||||
+}"""
|
|
||||||
f"This is a really long string, but just make sure that you reflow fstrings correctly {2+2:d}"
|
|
||||||
|
|
||||||
f"{2+2=}"
|
|
||||||
Reference in New Issue
Block a user