Skip to content

Commit 9c0768f

Browse files
committed
Fix lint issues
1 parent 8df927e commit 9c0768f

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24+
- { "py": "3.14", "tox_env": "py314-cov" }
2425
- { "py": "3.14", "tox_env": "py314" }
2526
- { "py": "3.13", "tox_env": "py313" }
26-
- { "py": "3.12", "tox_env": "py312-cov" }
2727
- { "py": "3.12", "tox_env": "py312" }
2828
- { "py": "3.11", "tox_env": "py311" }
2929
- { "py": "3.10", "tox_env": "py310" }

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ paths.source = [
9191
]
9292

9393
[tool.mypy]
94-
python_version = "3.8"
94+
python_version = "3.14"
9595
show_error_codes = true
9696
strict = true
9797

src/pytest_memray/marks.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from dataclasses import dataclass
44
from pathlib import Path
5+
from typing import Any
56
from typing import Iterable
67
from typing import Optional
78
from typing import Protocol
@@ -271,7 +272,7 @@ def limit_leaks(
271272
class _TrackedObjectsInfo:
272273
"""Type that holds information about objects that survived tracking."""
273274

274-
surviving_objects: list
275+
surviving_objects: list[Any]
275276
num_stacks: int
276277
native_stacks: bool
277278

@@ -330,7 +331,7 @@ def track_leaked_objects(
330331
_result_file: Path,
331332
_config: Config,
332333
_test_id: str,
333-
_surviving_objects: list | None = None,
334+
_surviving_objects: list[Any] | None = None,
334335
) -> _TrackedObjectsInfo | None:
335336
"""Track objects that survive the test execution."""
336337
if _surviving_objects is None:
@@ -364,17 +365,17 @@ def track_leaked_objects(
364365
class GetLeakedObjectsFunction(Protocol):
365366
"""A callable that retrieves the leaked objects from a test."""
366367

367-
def __call__(self) -> list:
368+
def __call__(self) -> list[Any]:
368369
"""Return the list of objects that leaked during the test."""
369370
...
370371

371372

372373
def get_leaked_objects(
373374
callback: GetLeakedObjectsFunction | None = None,
374-
_result_file: Path = None,
375-
_config: Config = None,
376-
_test_id: str = None,
377-
_surviving_objects: list | None = None,
375+
_result_file: Optional[Path] = None,
376+
_config: Optional[Config] = None,
377+
_test_id: Optional[str] = None,
378+
_surviving_objects: list[Any] | None = None,
378379
) -> None:
379380
"""Decorator to allow tests to retrieve leaked objects programmatically.
380381
@@ -395,7 +396,7 @@ def test_inspect_leaks(get_leaked_objects):
395396
"""
396397
if callback and _surviving_objects is not None:
397398
# Inject the function into the test
398-
callback._leaked_objects = _surviving_objects
399+
callback._leaked_objects = _surviving_objects # type: ignore[attr-defined]
399400

400401

401402
__all__ = [

src/pytest_memray/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Result:
113113
class Manager:
114114
def __init__(self, config: Config) -> None:
115115
self.results: dict[str, Result] = {}
116-
self.surviving_objects: dict[str, list] = {} # Store separately
116+
self.surviving_objects: dict[str, list[Any]] = {} # Store separately
117117
self.config = config
118118
path: Path | None = config.getvalue("memray_bin_path")
119119
self._tmp_dir: None | TemporaryDirectory[str] = None
@@ -213,7 +213,7 @@ def memory_reporting() -> Generator[None, None, None]:
213213
if track_objects:
214214
tracker_kwargs["track_object_lifetimes"] = True
215215

216-
tracker = Tracker(result_file, **tracker_kwargs)
216+
tracker = Tracker(result_file, **tracker_kwargs) # type: ignore[call-overload]
217217
with tracker:
218218
yield
219219

tox.ini

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[tox]
22
envlist =
3-
py312-cov
3+
py314-cov
4+
py314
5+
py313
46
py312
57
py311
68
py310
@@ -40,15 +42,15 @@ description = invoke sphinx-build to build the HTML docs
4042
setenv =
4143
VIRTUALENV_NO_SETUPTOOLS = false
4244
VIRTUALENV_NO_WHEEL = false
43-
basepython = python3.10
45+
basepython = python3.14
4446
extras =
4547
docs
4648
commands =
4749
make docs
4850

4951
[testenv:lint]
5052
description = lint code in {basepython}
51-
basepython = python3.10
53+
basepython = python3.14
5254
extras =
5355
lint
5456
commands =
@@ -61,7 +63,7 @@ whitelist_externals =
6163
description = cut a new release
6264
setenv =
6365
{[testenv:docs]setenv}
64-
basepython = python3.10
66+
basepython = python3.14
6567
skip_install = true
6668
deps =
6769
towncrier>=22.12
@@ -72,7 +74,7 @@ commands =
7274
description = generate a development environment
7375
setenv =
7476
{[testenv:docs]setenv}
75-
basepython = python3.10
77+
basepython = python3.14
7678
extras =
7779
docs
7880
lint

0 commit comments

Comments
 (0)