Skip to content

Commit

Permalink
fixup! DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
john-kurkowski committed Mar 15, 2024
1 parent a8ae3bf commit 7f5936c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from scripts import release


@dataclasses.dataclass(kw_only=True)
@dataclasses.dataclass
class Mocks:
"""Collection of all mocked objects used in the release script."""

Expand All @@ -33,13 +33,12 @@ def mock_calls(self) -> dict[str, Any]:

@pytest.fixture
def mocks() -> Iterator[Mocks]:
"""Stub reading user input."""
with (
mock.patch("builtins.input") as mock_input,
mock.patch("os.listdir") as mock_listdir,
mock.patch("requests.post") as mock_requests,
mock.patch("subprocess.run") as mock_subprocess,
):
"""Stub network and subprocesses."""
with mock.patch("builtins.input") as mock_input, mock.patch(
"os.listdir"
) as mock_listdir, mock.patch("requests.post") as mock_requests, mock.patch(
"subprocess.run"
) as mock_subprocess:
yield Mocks(
input=mock_input,
listdir=mock_listdir,
Expand Down

0 comments on commit 7f5936c

Please sign in to comment.