diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ccc0fee52..d93e3f40a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.6 + rev: 0.29.1 hooks: - id: check-github-workflows args: [ "--verbose" ] @@ -20,11 +20,11 @@ repos: - id: tox-ini-fmt args: ["-p", "fix"] - repo: https://github.com/tox-dev/pyproject-fmt - rev: "2.1.4" + rev: "2.2.1" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.5.0" + rev: "v0.5.7" hooks: - id: ruff-format - id: ruff diff --git a/src/virtualenv/create/via_global_ref/builtin/ref.py b/src/virtualenv/create/via_global_ref/builtin/ref.py index 2598c673a..e2fd45ffe 100644 --- a/src/virtualenv/create/via_global_ref/builtin/ref.py +++ b/src/virtualenv/create/via_global_ref/builtin/ref.py @@ -137,7 +137,7 @@ def run(self, creator, symlinks): class ExePathRefToDest(PathRefToDest, ExePathRef): """Link a exe path on the file system.""" - def __init__(self, src, targets, dest, must=RefMust.NA, when=RefWhen.ANY) -> None: # noqa: PLR0913 + def __init__(self, src, targets, dest, must=RefMust.NA, when=RefWhen.ANY) -> None: ExePathRef.__init__(self, src, must, when) PathRefToDest.__init__(self, src, dest, must, when) if not self.FS_CASE_SENSITIVE: diff --git a/src/virtualenv/seed/embed/via_app_data/pip_install/base.py b/src/virtualenv/seed/embed/via_app_data/pip_install/base.py index 961cd4251..0ca829713 100644 --- a/src/virtualenv/seed/embed/via_app_data/pip_install/base.py +++ b/src/virtualenv/seed/embed/via_app_data/pip_install/base.py @@ -194,7 +194,7 @@ def __init__(self, target_dir, version_info, executable, name) -> None: self.variants = {"", "X", "X.Y"} self._name = name - def _write_script(self, names, shebang, script_bytes, filenames, ext): # noqa: PLR0913 + def _write_script(self, names, shebang, script_bytes, filenames, ext): names.add(f"{self._name}{self.version_info[0]}.{self.version_info[1]}") super()._write_script(names, shebang, script_bytes, filenames, ext) diff --git a/tests/conftest.py b/tests/conftest.py index 9bbe86aca..5995d228f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -234,7 +234,7 @@ def finish(): # _no_coverage tells coverage_env to disable coverage injection for _no_coverage user. -@pytest.fixture() +@pytest.fixture def _no_coverage(): pass @@ -291,7 +291,7 @@ def special_char_name(): return result -@pytest.fixture() +@pytest.fixture def special_name_dir(tmp_path, special_char_name): return Path(str(tmp_path)) / special_char_name @@ -332,7 +332,7 @@ def change_env_var(key, value): del os.environ[key] # pragma: no cover -@pytest.fixture() +@pytest.fixture def temp_app_data(monkeypatch, tmp_path): app_data = tmp_path / "app-data" monkeypatch.setenv("VIRTUALENV_OVERRIDE_APP_DATA", str(app_data)) @@ -344,7 +344,7 @@ def for_py_version(): return f"{sys.version_info.major}.{sys.version_info.minor}" -@pytest.fixture() +@pytest.fixture def _skip_if_test_in_system(session_app_data): current = PythonInfo.current(session_app_data) if current.system_executable is not None: @@ -353,12 +353,12 @@ def _skip_if_test_in_system(session_app_data): if IS_PYPY or (IS_WIN and sys.version_info[0:2] >= (3, 13)): # https://github.com/adamchainz/time-machine/issues/456 - @pytest.fixture() + @pytest.fixture def time_freeze(freezer): return freezer.move_to else: - @pytest.fixture() + @pytest.fixture def time_freeze(time_machine): return lambda s: time_machine.move_to(s, tick=False) diff --git a/tests/integration/test_zipapp.py b/tests/integration/test_zipapp.py index dfc6d9759..b14344d16 100644 --- a/tests/integration/test_zipapp.py +++ b/tests/integration/test_zipapp.py @@ -75,7 +75,7 @@ def zipapp_test_env(tmp_path_factory): shutil.rmtree(str(base_path)) -@pytest.fixture() +@pytest.fixture def call_zipapp(zipapp, tmp_path, zipapp_test_env, temp_app_data): # noqa: ARG001 def _run(*args): cmd = [str(zipapp_test_env), str(zipapp), "-vv", str(tmp_path / "env"), *list(args)] @@ -84,7 +84,7 @@ def _run(*args): return _run -@pytest.fixture() +@pytest.fixture def call_zipapp_symlink(zipapp, tmp_path, zipapp_test_env, temp_app_data): # noqa: ARG001 def _run(*args): symlinked = zipapp.parent / "symlinked_virtualenv.pyz" diff --git a/tests/unit/activation/conftest.py b/tests/unit/activation/conftest.py index 87e3307aa..26a601297 100644 --- a/tests/unit/activation/conftest.py +++ b/tests/unit/activation/conftest.py @@ -15,7 +15,7 @@ class ActivationTester: - def __init__(self, of_class, session, cmd, activate_script, extension) -> None: # noqa: PLR0913 + def __init__(self, of_class, session, cmd, activate_script, extension) -> None: self.of_class = of_class self._creator = session.creator self._version_cmd = [cmd, "--version"] @@ -241,7 +241,7 @@ def activation_python(request, tmp_path_factory, special_char_name, current_fast return session -@pytest.fixture() +@pytest.fixture def activation_tester(activation_python, monkeypatch, tmp_path, is_inside_ci): def _tester(tester_class): tester = tester_class(activation_python) diff --git a/tests/unit/activation/test_powershell.py b/tests/unit/activation/test_powershell.py index b32a6a2a3..c81a4cca4 100644 --- a/tests/unit/activation/test_powershell.py +++ b/tests/unit/activation/test_powershell.py @@ -8,7 +8,7 @@ from virtualenv.activation import PowerShellActivator -@pytest.mark.slow() +@pytest.mark.slow def test_powershell(activation_tester_class, activation_tester, monkeypatch): monkeypatch.setenv("TERM", "xterm") diff --git a/tests/unit/config/cli/test_parser.py b/tests/unit/config/cli/test_parser.py index cb656c386..1dc7e055a 100644 --- a/tests/unit/config/cli/test_parser.py +++ b/tests/unit/config/cli/test_parser.py @@ -10,7 +10,7 @@ from virtualenv.run import session_via_cli -@pytest.fixture() +@pytest.fixture def gen_parser_no_conf_env(monkeypatch, tmp_path): keys_to_delete = {key for key in os.environ if key.startswith("VIRTUALENV_")} for key in keys_to_delete: diff --git a/tests/unit/config/test___main__.py b/tests/unit/config/test___main__.py index defa58c4f..fc6b3eef4 100644 --- a/tests/unit/config/test___main__.py +++ b/tests/unit/config/test___main__.py @@ -26,7 +26,7 @@ def test_main(): assert out -@pytest.fixture() +@pytest.fixture def raise_on_session_done(mocker): def _func(exception): from virtualenv.run import session_via_cli # noqa: PLC0415 diff --git a/tests/unit/config/test_env_var.py b/tests/unit/config/test_env_var.py index 596cfdad9..5f364978d 100644 --- a/tests/unit/config/test_env_var.py +++ b/tests/unit/config/test_env_var.py @@ -12,7 +12,7 @@ from virtualenv.run import session_via_cli -@pytest.fixture() +@pytest.fixture def _empty_conf(tmp_path, monkeypatch): conf = tmp_path / "conf.ini" monkeypatch.setenv(IniConfig.VIRTUALENV_CONFIG_FILE_ENV_VAR, str(conf)) diff --git a/tests/unit/create/test_interpreters.py b/tests/unit/create/test_interpreters.py index b6b58df4d..ae4452b13 100644 --- a/tests/unit/create/test_interpreters.py +++ b/tests/unit/create/test_interpreters.py @@ -9,7 +9,7 @@ from virtualenv.run import cli_run -@pytest.mark.slow() +@pytest.mark.slow def test_failed_to_find_bad_spec(): of_id = uuid4().hex with pytest.raises(RuntimeError) as context: diff --git a/tests/unit/create/via_global_ref/builtin/conftest.py b/tests/unit/create/via_global_ref/builtin/conftest.py index bb505db28..a5808c58b 100644 --- a/tests/unit/create/via_global_ref/builtin/conftest.py +++ b/tests/unit/create/via_global_ref/builtin/conftest.py @@ -11,16 +11,16 @@ sys.path.append(str(Path(__file__).parent)) -@pytest.fixture() +@pytest.fixture def py_info(py_info_name): return read_fixture(py_info_name) -@pytest.fixture() +@pytest.fixture def mock_files(mocker): return lambda paths, files: path.mock_files(mocker, paths, files) -@pytest.fixture() +@pytest.fixture def mock_pypy_libs(mocker): return lambda pypy, libs: path.mock_pypy_libs(mocker, pypy, libs) diff --git a/tests/unit/discovery/windows/conftest.py b/tests/unit/discovery/windows/conftest.py index 13d9d70fd..21c16891c 100644 --- a/tests/unit/discovery/windows/conftest.py +++ b/tests/unit/discovery/windows/conftest.py @@ -6,7 +6,7 @@ import pytest -@pytest.fixture() +@pytest.fixture def _mock_registry(mocker): # noqa: C901 from virtualenv.discovery.windows.pep514 import winreg # noqa: PLC0415 @@ -78,7 +78,7 @@ def _mock_pyinfo(major, minor, arch, exe): return info -@pytest.fixture() +@pytest.fixture def _populate_pyinfo_cache(monkeypatch): """Add metadata to virtualenv.discovery.cached_py_info._CACHE for all (mocked) registry entries""" import virtualenv.discovery.cached_py_info # noqa: PLC0415 diff --git a/tests/unit/seed/embed/test_bootstrap_link_via_app_data.py b/tests/unit/seed/embed/test_bootstrap_link_via_app_data.py index 7db52e1f1..4fd3d30c9 100644 --- a/tests/unit/seed/embed/test_bootstrap_link_via_app_data.py +++ b/tests/unit/seed/embed/test_bootstrap_link_via_app_data.py @@ -23,7 +23,7 @@ from pytest_mock import MockerFixture -@pytest.mark.slow() +@pytest.mark.slow @pytest.mark.parametrize("copies", [False, True] if fs_supports_symlink() else [True]) def test_seed_link_via_app_data(tmp_path, coverage_env, current_fastest, copies): current = PythonInfo.current_system() @@ -140,7 +140,7 @@ def read_only_dir(d): os.chmod(name, os.stat(name).st_mode | write) -@pytest.fixture() +@pytest.fixture def read_only_app_data(temp_app_data): temp_app_data.mkdir() with read_only_dir(temp_app_data): @@ -204,7 +204,7 @@ def test_populated_read_only_cache_and_copied_app_data(tmp_path, current_fastest assert cli_run(["--read-only-app-data", *cmd]) -@pytest.mark.slow() +@pytest.mark.slow @pytest.mark.parametrize("pkg", ["pip", "setuptools", "wheel"]) @pytest.mark.usefixtures("session_app_data", "current_fastest", "coverage_env") def test_base_bootstrap_link_via_app_data_no(tmp_path, pkg): diff --git a/tests/unit/seed/embed/test_pip_invoke.py b/tests/unit/seed/embed/test_pip_invoke.py index 0c7e6b665..7b38d7cc9 100644 --- a/tests/unit/seed/embed/test_pip_invoke.py +++ b/tests/unit/seed/embed/test_pip_invoke.py @@ -12,7 +12,7 @@ from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SUPPORT -@pytest.mark.slow() +@pytest.mark.slow @pytest.mark.parametrize("no", ["pip", "setuptools", "wheel", ""]) def test_base_bootstrap_via_pip_invoke(tmp_path, coverage_env, mocker, current_fastest, no): # noqa: C901 extra_search_dir = tmp_path / "extra" diff --git a/tests/unit/seed/wheels/test_acquire.py b/tests/unit/seed/wheels/test_acquire.py index ceff78bb4..20979775b 100644 --- a/tests/unit/seed/wheels/test_acquire.py +++ b/tests/unit/seed/wheels/test_acquire.py @@ -88,7 +88,7 @@ def test_download_fails(mocker, for_py_version, session_app_data): ] == exc.cmd -@pytest.fixture() +@pytest.fixture def downloaded_wheel(mocker): wheel = Wheel.from_path(Path("setuptools-0.0.0-py2.py3-none-any.whl")) return wheel, mocker.patch("virtualenv.seed.wheels.acquire.download_wheel", return_value=wheel)