diff --git a/pyproject.toml b/pyproject.toml index eb6695b4..f8c89a48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "ops-scenario" -version = "7.0.0" +version = "7.0.1" authors = [ { name = "Pietro Pasotti", email = "pietro.pasotti@canonical.com" } diff --git a/scenario/state.py b/scenario/state.py index e7190ea5..9179735d 100644 --- a/scenario/state.py +++ b/scenario/state.py @@ -139,12 +139,13 @@ def __new__(cls, *args, **kwargs): # declared, which aligns with dataclasses. Simpler ways of # getting the arguments (like __annotations__) do not have that # guarantee, although in practice it is the case. - parameters = inspect.signature(cls).parameters + parameters = inspect.signature(cls.__init__).parameters required_args = [ name for name in tuple(parameters) if parameters[name].default is inspect.Parameter.empty and name not in kwargs + and name != "self" ] n_posargs = len(args) max_n_posargs = cls._max_positional_args