From 21888b531f43600b54356a7dda5742ffdacd027e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 12:51:51 +0000 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#2320) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0) * chore: use Path.iterdir Signed-off-by: Henry Schreiner * fix: Path.iterdir usage os.listdir returned entry names rather than their full path --------- Signed-off-by: Henry Schreiner Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner Co-authored-by: mayeut --- .pre-commit-config.yaml | 2 +- test/test_environment.py | 2 +- test/test_from_sdist.py | 2 +- test/test_testing.py | 3 +-- test/utils.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd425c89..870f7352 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.10 + rev: v0.11.0 hooks: - id: ruff args: ["--fix", "--show-fixes"] diff --git a/test/test_environment.py b/test/test_environment.py index 4f8a3170..6e7ed6fd 100644 --- a/test/test_environment.py +++ b/test/test_environment.py @@ -89,7 +89,7 @@ def test_overridden_path(tmp_path, capfd): }, ) - assert len(os.listdir(output_dir)) == 0 + assert len(list(output_dir.iterdir())) == 0 captured = capfd.readouterr() assert "python available on PATH doesn't match our installed instance" in captured.err.replace( "venv", "installed" diff --git a/test/test_from_sdist.py b/test/test_from_sdist.py index 3bb7926d..b916271c 100644 --- a/test/test_from_sdist.py +++ b/test/test_from_sdist.py @@ -53,7 +53,7 @@ def cibuildwheel_from_sdist_run( env=env, check=True, ) - return os.listdir(tmp_output_dir) + return [p.name for p in Path(tmp_output_dir).iterdir()] # tests diff --git a/test/test_testing.py b/test/test_testing.py index 4dfda914..8bd810f5 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -1,5 +1,4 @@ import inspect -import os import subprocess import textwrap from pathlib import Path @@ -180,7 +179,7 @@ def test_failing_test(tmp_path): }, ) - assert len(os.listdir(output_dir)) == 0 + assert len(list(output_dir.iterdir())) == 0 @pytest.mark.parametrize("test_runner", ["pytest", "unittest"]) diff --git a/test/utils.py b/test/utils.py index 921494e2..4548f0a5 100644 --- a/test/utils.py +++ b/test/utils.py @@ -140,7 +140,7 @@ def cibuildwheel_run( cwd=project_path, check=True, ) - wheels = os.listdir(output_dir or tmp_output_dir) + wheels = [p.name for p in (output_dir or Path(tmp_output_dir)).iterdir()] return wheels