Skip to content

Commit 9f9dc62

Browse files
Fix the CI (#2593)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f79864b commit 9f9dc62

File tree

13 files changed

+30
-20
lines changed

13 files changed

+30
-20
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: tox-ini-fmt
1515
args: ["-p", "fix"]
1616
- repo: https://github.com/tox-dev/pyproject-fmt
17-
rev: "0.12.0"
17+
rev: "0.12.1"
1818
hooks:
1919
- id: pyproject-fmt
2020
additional_dependencies: ["tox>=4.6"]
@@ -24,7 +24,7 @@ repos:
2424
- id: prettier
2525
args: ["--print-width=120", "--prose-wrap=always"]
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.0.272"
27+
rev: "v0.0.275"
2828
hooks:
2929
- id: ruff
3030
args: [--fix, --exit-non-zero-on-fix]

docs/changelog/2592.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix test suite - by :user:`gaborbernat`.

docs/render_cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from argparse import SUPPRESS
44
from collections import namedtuple
55
from contextlib import contextmanager
6+
from typing import Any, ClassVar
67

78
from docutils import nodes as n
89
from docutils.parsers.rst.directives import unchanged_required
@@ -24,8 +25,8 @@
2425

2526

2627
class CliTable(SphinxDirective):
27-
name = "table_cli"
28-
option_spec = {"module": unchanged_required, "func": unchanged_required}
28+
name: ClassVar[str] = "table_cli"
29+
option_spec: ClassVar[str, Any] = {"module": unchanged_required, "func": unchanged_required}
2930

3031
def run(self):
3132
module_name, attr_name = self.options["module"], self.options["func"]
@@ -109,7 +110,7 @@ def _build_table(self, options, title, description):
109110
options_group += body
110111
return table
111112

112-
plugins = {
113+
plugins: ClassVar[dict[str, str]] = {
113114
"creator": "virtualenv.create",
114115
"seed": "virtualenv.seed",
115116
"activators": "virtualenv.activate",

src/virtualenv/activation/via_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def generate(self, creator):
2727
generated = self._generate(replacements, self.templates(), dest_folder, creator)
2828
if self.flag_prompt is not None:
2929
creator.pyenv_cfg["prompt"] = self.flag_prompt
30-
return generated # noqa: RET504
30+
return generated
3131

3232
def replacements(self, creator, dest_folder): # noqa: ARG002
3333
return {

src/virtualenv/config/convert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44
import os
5+
from typing import ClassVar
56

67

78
class TypeData:
@@ -17,7 +18,7 @@ def convert(self, value):
1718

1819

1920
class BoolType(TypeData):
20-
BOOLEAN_STATES = {
21+
BOOLEAN_STATES: ClassVar[dict[str, bool]] = {
2122
"1": True,
2223
"yes": True,
2324
"true": True,

src/virtualenv/config/ini.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import os
55
from configparser import ConfigParser
66
from pathlib import Path
7+
from typing import ClassVar
78

89
from platformdirs import user_config_dir
910

1011
from .convert import convert
1112

1213

1314
class IniConfig:
14-
VIRTUALENV_CONFIG_FILE_ENV_VAR = "VIRTUALENV_CONFIG_FILE"
15-
STATE = {None: "failed to parse", True: "active", False: "missing"}
15+
VIRTUALENV_CONFIG_FILE_ENV_VAR: ClassVar[str] = "VIRTUALENV_CONFIG_FILE"
16+
STATE: ClassVar[dict[bool | None, str]] = {None: "failed to parse", True: "active", False: "missing"}
1617

1718
section = "virtualenv"
1819

src/virtualenv/create/via_global_ref/_virtualenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class _Finder:
4848
# lock[0] is threading.Lock(), but initialized lazily to avoid importing threading very early at startup,
4949
# because there are gevent-based applications that need to be first to import threading by themselves.
5050
# See https://github.com/pypa/virtualenv/issues/1895 for details.
51-
lock = []
51+
lock = [] # noqa: RUF012
5252

5353
def find_spec(self, fullname, path, target=None): # noqa: ARG002
5454
if fullname in _DISTUTILS_PATCH and self.fullname is None:

src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def sources(cls, interpreter):
7474
@property
7575
def reload_code(self):
7676
result = super().reload_code
77-
result = dedent(
77+
return dedent(
7878
f"""
7979
# the bundled site.py always adds the global site package if we're on python framework build, escape this
8080
import sys
@@ -86,7 +86,6 @@ def reload_code(self):
8686
sys._framework = before
8787
""",
8888
)
89-
return result
9089

9190

9291
def fix_mach_o(exe, current, new, max_size):

src/virtualenv/discovery/py_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def _resolve_to_system(cls, app_data, target):
434434
target.executable = start_executable
435435
return target
436436

437-
_cache_exe_discovery = {}
437+
_cache_exe_discovery = {} # noqa: RUF012
438438

439439
def discover_exe(self, app_data, prefix, exact=True, env=None): # noqa: FBT002
440440
key = prefix, exact

tests/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from contextlib import contextmanager
88
from functools import partial
99
from pathlib import Path
10+
from typing import ClassVar
1011

1112
import pytest
1213

@@ -24,7 +25,7 @@ def pytest_configure(config):
2425
"""Ensure randomly is called before we re-order"""
2526
manager = config.pluginmanager
2627

27-
order = manager.hook.pytest_collection_modifyitems._nonwrappers # noqa: SLF001
28+
order = manager.hook.pytest_collection_modifyitems._hookimpls # noqa: SLF001
2829
dest = next((i for i, p in enumerate(order) if p.plugin is manager.getplugin("randomly")), None)
2930
if dest is not None:
3031
from_pos = next(i for i, p in enumerate(order) if p.plugin is manager.getplugin(__file__))
@@ -242,8 +243,10 @@ def _no_coverage():
242243
import coverage
243244

244245
class EnableCoverage:
245-
_COV_FILE = Path(coverage.__file__)
246-
_ROOT_COV_FILES_AND_FOLDERS = [i for i in _COV_FILE.parents[1].iterdir() if i.name.startswith("coverage")]
246+
_COV_FILE: ClassVar[Path] = Path(coverage.__file__)
247+
_ROOT_COV_FILES_AND_FOLDERS: ClassVar[list[Path]] = [
248+
i for i in _COV_FILE.parents[1].iterdir() if i.name.startswith("coverage")
249+
]
247250

248251
def __init__(self, link) -> None:
249252
self.link = link

0 commit comments

Comments
 (0)