Skip to content

Commit 0a11b78

Browse files
committed
Rewrite ReqMock as dataclass
1 parent f337374 commit 0a11b78

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

tests/unit/test_wheel_builder.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import os
3+
from dataclasses import dataclass
34
from pathlib import Path
45
from typing import Optional, cast
56

@@ -31,30 +32,16 @@ def test_contains_egg_info(s: str, expected: bool) -> None:
3132
assert result == expected
3233

3334

35+
@dataclass
3436
class ReqMock:
35-
def __init__(
36-
self,
37-
name: str = "pendulum",
38-
is_wheel: bool = False,
39-
editable: bool = False,
40-
link: Optional[Link] = None,
41-
constraint: bool = False,
42-
source_dir: Optional[str] = "/tmp/pip-install-123/pendulum",
43-
use_pep517: bool = True,
44-
supports_pyproject_editable: bool = False,
45-
) -> None:
46-
self.name = name
47-
self.is_wheel = is_wheel
48-
self.editable = editable
49-
self.link = link
50-
self.constraint = constraint
51-
self.source_dir = source_dir
52-
self.use_pep517 = use_pep517
53-
self._supports_pyproject_editable = supports_pyproject_editable
54-
55-
@property
56-
def supports_pyproject_editable(self) -> bool:
57-
return self._supports_pyproject_editable
37+
name: str = "pendulum"
38+
is_wheel: bool = False
39+
editable: bool = False
40+
link: Optional[Link] = None
41+
constraint: bool = False
42+
source_dir: Optional[str] = "/tmp/pip-install-123/pendulum"
43+
use_pep517: bool = True
44+
supports_pyproject_editable: bool = False
5845

5946

6047
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)