Skip to content

Commit 5668d2b

Browse files
authored
fix formatting on python bidings (#4041)
1 parent 8303580 commit 5668d2b

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

bindings/python/scripts/verify_wheel_platform_tag.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,19 @@ def parse_wheel_tag(wheel_path: Path) -> tuple[tuple[int, int], str]:
8080

8181

8282
def main() -> int:
83-
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
83+
parser = argparse.ArgumentParser(
84+
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
85+
)
8486
parser.add_argument("wheel", nargs="?", type=Path, help="Path to the .whl file")
85-
parser.add_argument("jre", nargs="?", type=Path, help="Path to the bundled JRE/JDK directory")
86-
parser.add_argument("--jre", dest="jre_only", type=Path, help="Inspect a JRE only and print its required tag")
87+
parser.add_argument(
88+
"jre", nargs="?", type=Path, help="Path to the bundled JRE/JDK directory"
89+
)
90+
parser.add_argument(
91+
"--jre",
92+
dest="jre_only",
93+
type=Path,
94+
help="Inspect a JRE only and print its required tag",
95+
)
8796
args = parser.parse_args()
8897

8998
if args.jre_only is not None:

bindings/python/tests/test_wheel_platform_tag.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919

2020
import pytest
2121

22-
23-
SCRIPT_PATH = Path(__file__).resolve().parents[1] / "scripts" / "verify_wheel_platform_tag.py"
22+
SCRIPT_PATH = (
23+
Path(__file__).resolve().parents[1] / "scripts" / "verify_wheel_platform_tag.py"
24+
)
2425

2526

2627
def _load_verifier():
27-
spec = importlib.util.spec_from_file_location("verify_wheel_platform_tag", SCRIPT_PATH)
28+
spec = importlib.util.spec_from_file_location(
29+
"verify_wheel_platform_tag", SCRIPT_PATH
30+
)
2831
module = importlib.util.module_from_spec(spec)
2932
assert spec.loader is not None
3033
spec.loader.exec_module(module)
@@ -62,7 +65,9 @@ def test_parse_wheel_tag_extracts_version_and_arch(tmp_path: Path) -> None:
6265
assert arch == "x86_64"
6366

6467

65-
def test_main_succeeds_when_tag_matches(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
68+
def test_main_succeeds_when_tag_matches(
69+
tmp_path: Path, capsys: pytest.CaptureFixture[str]
70+
) -> None:
6671
verifier = _load_verifier()
6772
jre_dir = tmp_path / "jre"
6873
jre_dir.mkdir()
@@ -76,7 +81,9 @@ def test_main_succeeds_when_tag_matches(tmp_path: Path, capsys: pytest.CaptureFi
7681
assert "OK" in capsys.readouterr().out
7782

7883

79-
def test_main_fails_when_tag_higher_than_jre(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
84+
def test_main_fails_when_tag_higher_than_jre(
85+
tmp_path: Path, capsys: pytest.CaptureFixture[str]
86+
) -> None:
8087
"""Reproduces issue #4037: wheel tagged manylinux_2_35 but JRE only needs GLIBC_2.34."""
8188
verifier = _load_verifier()
8289
jre_dir = tmp_path / "jre"
@@ -93,7 +100,9 @@ def test_main_fails_when_tag_higher_than_jre(tmp_path: Path, capsys: pytest.Capt
93100
assert "manylinux_2_35" in captured.err or "manylinux_2_34" in captured.err
94101

95102

96-
def test_main_fails_when_tag_lower_than_jre(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
103+
def test_main_fails_when_tag_lower_than_jre(
104+
tmp_path: Path, capsys: pytest.CaptureFixture[str]
105+
) -> None:
97106
"""A too-low tag would let the wheel install on systems where the JRE cannot run."""
98107
verifier = _load_verifier()
99108
jre_dir = tmp_path / "jre"

0 commit comments

Comments
 (0)