Skip to content

Commit 9d1e6d9

Browse files
authored
Merge pull request #173 from dmtucker/dataclass
Replace attrs with dataclasses
2 parents bf700d9 + 63102ec commit 9d1e6d9

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ classifiers = [
3030
]
3131
requires-python = ">=3.7"
3232
dependencies = [
33-
"attrs>=19.0",
3433
"filelock>=3.0",
3534
"mypy>=1.0",
3635
"pytest>=7.0",

src/pytest_mypy.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Mypy static type checker plugin for Pytest"""
22

3+
from dataclasses import dataclass
34
import json
45
from pathlib import Path
56
from tempfile import NamedTemporaryFile
67
from typing import Dict, List, Optional, TextIO
78
import warnings
89

9-
import attr
1010
from filelock import FileLock # type: ignore
1111
import mypy.api
1212
import pytest
@@ -197,18 +197,18 @@ def runtest(self):
197197
raise MypyError(f"mypy exited with status {results.status}.")
198198

199199

200-
@attr.s(frozen=True, kw_only=True)
200+
@dataclass(frozen=True) # compat python < 3.10 (kw_only=True)
201201
class MypyResults:
202202
"""Parsed results from Mypy."""
203203

204204
_abspath_errors_type = Dict[str, List[str]]
205205

206-
opts = attr.ib(type=List[str])
207-
stdout = attr.ib(type=str)
208-
stderr = attr.ib(type=str)
209-
status = attr.ib(type=int)
210-
abspath_errors = attr.ib(type=_abspath_errors_type)
211-
unmatched_stdout = attr.ib(type=str)
206+
opts: List[str]
207+
stdout: str
208+
stderr: str
209+
status: int
210+
abspath_errors: _abspath_errors_type
211+
unmatched_stdout: str
212212

213213
def dump(self, results_f: TextIO) -> None:
214214
"""Cache results in a format that can be parsed by load()."""

0 commit comments

Comments
 (0)