Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ jobs:
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: '**/junit.xml'
path: junit.xml
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
with:
files: '**/junit.xml'
files: junit.xml
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Upload coverage
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test-py: ## run python tests
tests-py: test-py

coverage-py: ## run python tests and collect test coverage
python -m pytest -v csp_gateway/tests --cov=csp_gateway --cov-report term-missing --cov-report xml
python -m pytest -v csp_gateway/tests --junitxml=junit.xml --cov=csp_gateway --cov-report term-missing --cov-report xml

.PHONY: test-js tests-js coverage-js
test-js: ## run js tests
Expand Down
18 changes: 15 additions & 3 deletions csp_gateway/server/demo/omnibus.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ class ExampleGatewayChannels(GatewayChannels):
example_list: ts[List[ExampleData]] = None
never_ticks: ts[ExampleData] = None

s_example: ts[State[ExampleData]] = None
# State fields can be added via annotation or the `set_state` API in the module's `connect` method
example_with_state: Annotated[ts[ExampleData], State(("id", "x"))] = None
example_with_state_multiple: Annotated[
ts[ExampleData],
State(("id", "x")),
State(("id", "y"), alias="example_with_state_alternative"),
] = None
# example: Set in connect with a different schema, to show flexibility of state definition

basket: Dict[ExampleEnum, ts[ExampleData]] = None
str_basket: Dict[str, ts[ExampleData]] = None
Expand Down Expand Up @@ -179,6 +186,8 @@ def connect(self, channels: ExampleGatewayChannels):
# Channels set via `set_channel`
channels.set_channel(ExampleGatewayChannels.example, data)
channels.set_channel(ExampleGatewayChannels.example_list, data_list)
channels.set_channel(ExampleGatewayChannels.example_with_state, data)
channels.set_channel(ExampleGatewayChannels.example_with_state_multiple, data)

# Generic channel for sending data from non-csp sources
channels.add_send_channel(ExampleGatewayChannels.example)
Expand All @@ -187,8 +196,11 @@ def connect(self, channels: ExampleGatewayChannels):
channels.add_send_channel(ExampleGatewayChannels.basket, ExampleEnum.C)
channels.add_send_channel(ExampleGatewayChannels.basket)

# Rudimentary state accumulation via `set_state`
channels.set_state(ExampleGatewayChannels.example, "id")
# State accumulation via `set_state`
channels.set_state(
ExampleGatewayChannels.example,
("id",),
)

# Create some data streams for dict baskets
data_a = self.subscribe(
Expand Down
Loading
Loading