Skip to content

test: add unit tests for galaxy/core/events.py#327

Open
nuthalapativarun wants to merge 1 commit intomicrosoft:pre-releasefrom
nuthalapativarun:test/galaxy-core-events-unit-tests
Open

test: add unit tests for galaxy/core/events.py#327
nuthalapativarun wants to merge 1 commit intomicrosoft:pre-releasefrom
nuthalapativarun:test/galaxy-core-events-unit-tests

Conversation

@nuthalapativarun
Copy link
Copy Markdown

Summary

galaxy/core/events.py had no dedicated unit tests. The Galaxy framework's event system is foundational (used by constellation agents, device manager, and WebSocket observers), so coverage helps catch regressions early.

Changes

Added tests/unit/galaxy/core/test_events.py with 37 test cases covering:

Class Tests
EventType All members are strings, unique values, named groups exist
Event / sub-dataclasses Fields, defaults, specialised fields (TaskEvent, ConstellationEvent, AgentEvent, DeviceEvent)
IEventObserver Interface contract, cannot instantiate abstract class directly
IEventPublisher Cannot instantiate abstract class directly
EventBus subscribe all, subscribe typed, unsubscribe, publish routing, multiple observers, no-subscriber noop, failing observer isolation, singleton get_event_bus()

Testing

Tests follow the existing tests/unit/galaxy/ conventions (pytest classes, pytest-asyncio for async paths, unittest.mock.AsyncMock for observer mocks). All tests are designed for Python 3.10+ which is the project's stated minimum.

Cover the core event system components that had no dedicated unit tests:
- EventType enum (all members, unique values, string type)
- Event / TaskEvent / ConstellationEvent / AgentEvent / DeviceEvent dataclasses
- IEventObserver abstract interface (contract and instantiation guard)
- IEventPublisher abstract interface (instantiation guard)
- EventBus (subscribe, unsubscribe, publish, error isolation, singleton)

Tests are structured using pytest classes and pytest-asyncio for the
async publish_event paths.  They follow the pattern used in the existing
tests/unit/galaxy/ test suite.
@nuthalapativarun
Copy link
Copy Markdown
Author

Hi team — gentle ping on this PR. Happy to rebase or address any feedback if needed. Let me know if there's anything blocking review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant