Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 22, 2024
1 parent 114a4b5 commit 6730386
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/virtualenv/create/via_global_ref/builtin/ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/seed/embed/via_app_data/pip_install/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand All @@ -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:
Expand All @@ -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)
4 changes: 2 additions & 2 deletions tests/integration/test_zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/activation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/activation/test_powershell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/cli/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/test___main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/test_env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/create/test_interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/create/via_global_ref/builtin/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions tests/unit/discovery/windows/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/seed/embed/test_bootstrap_link_via_app_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/seed/embed/test_pip_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/seed/wheels/test_acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6730386

Please sign in to comment.