Skip to content

Commit

Permalink
Use a class creating function, per review.
Browse files Browse the repository at this point in the history
Also fix doing copy/deepcopy of the objects, and provide more information when the args are wrong (also per review).
  • Loading branch information
tonyandrewmeyer committed Jul 8, 2024
1 parent 36c9de7 commit 1615fad
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 73 deletions.
8 changes: 3 additions & 5 deletions scenario/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tempfile
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, Final, List, Optional, Type, Union, cast
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union, cast

from ops import CharmBase, EventBase

Expand All @@ -19,7 +19,7 @@
Storage,
_CharmSpec,
_Event,
_MaxPositionalArgs,
_max_posargs,
)

if TYPE_CHECKING: # pragma: no cover
Expand All @@ -36,7 +36,7 @@


@dataclasses.dataclass(frozen=True)
class ActionOutput(_MaxPositionalArgs):
class ActionOutput(_max_posargs(0)):
"""Wraps the results of running an action event with `run_action`."""

state: "State"
Expand All @@ -50,8 +50,6 @@ class ActionOutput(_MaxPositionalArgs):
failure: Optional[str] = None
"""If the action is not a success: the message the charm set when failing the action."""

_max_positional_args: Final = 0

@property
def success(self) -> bool:
"""Return whether this action was a success."""
Expand Down
Loading

0 comments on commit 1615fad

Please sign in to comment.