Add crew name attribute to CrewBase annotated classes (#2890)

* Add crew name attribute to `CrewBase` annotated classes

* Fix linting issue
This commit is contained in:
Vini Brasil
2025-05-22 16:37:54 -03:00
committed by GitHub
parent d131d4ef96
commit 222912d14b
2 changed files with 5 additions and 1 deletions

View File

@@ -252,5 +252,6 @@ def CrewBase(cls: T) -> T:
# Include base class (qual)name in the wrapper class (qual)name.
WrappedClass.__name__ = CrewBase.__name__ + "(" + cls.__name__ + ")"
WrappedClass.__qualname__ = CrewBase.__qualname__ + "(" + cls.__name__ + ")"
WrappedClass._crew_name = cls.__name__
return cast(T, WrappedClass)

View File

@@ -1,5 +1,4 @@
from typing import List
from unittest.mock import patch
import pytest
@@ -234,3 +233,7 @@ def test_multiple_before_after_kickoff():
assert "plants" in result.raw, "First before_kickoff not executed"
assert "processed first" in result.raw, "First after_kickoff not executed"
assert "processed second" in result.raw, "Second after_kickoff not executed"
def test_crew_name():
crew = InternalCrew()
assert crew._crew_name == "InternalCrew"