On Wed, Sep 18, 2024 at 8:58 AM Juraj Linkeš <juraj.lin...@pantheon.tech> wrote:
>
>
>
> On 27. 8. 2024 18:36, Jeremy Spewock wrote:
> > On Wed, Aug 21, 2024 at 10:53 AM Juraj Linkeš
> > <juraj.lin...@pantheon.tech> wrote:
> > <snip>
> >> diff --git a/dts/framework/testbed_model/capability.py 
> >> b/dts/framework/testbed_model/capability.py
> >> index 8899f07f76..9a79e6ebb3 100644
> >> --- a/dts/framework/testbed_model/capability.py
> >> +++ b/dts/framework/testbed_model/capability.py
> >> @@ -5,14 +5,40 @@
> > <snip>
> >> +    @classmethod
> >> +    def get_supported_capabilities(
> >> +        cls, sut_node: SutNode, topology: "Topology"
> >> +    ) -> set["DecoratedNicCapability"]:
> >> +        """Overrides :meth:`~Capability.get_supported_capabilities`.
> >> +
> >> +        The capabilities are first sorted by decorators, then reduced 
> >> into a single function which
> >> +        is then passed to the decorator. This way we only execute each 
> >> decorator only once.
> >> +        """
> >> +        supported_conditional_capabilities: set["DecoratedNicCapability"] 
> >> = set()
> >> +        logger = get_dts_logger(f"{sut_node.name}.{cls.__name__}")
> >> +        if topology.type is Topology.type.no_link:
> >
> > As a follow-up, I didn't notice this during my initial review, but in
> > testing this line was throwing attribute errors for me due to Topology
> > not having an attribute named `type`. I think this was because of
> > `Topology.type.no_link` since this attribute isn't initialized on the
> > class itself. I fixed this by just replacing it with
> > `TopologyType.no_link` locally.
> >
>
> I also ran into this, the type attribute is not a class variable. Your
> solution works (and I also originally fixed it with exactly that), but I
> then I realized topology.type.no_link also works (and was probably my
> intention), which doesn't require the extra import of TopologyType.

Right, that's smart. I forget that you can do that with enums.

Reply via email to