Added owlbot.testing package with pytest plugin, event factories, and recording Owncast stubs for module tests.
Audit / Dependencies (push) Successful in 8s
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 19s
CI / Tests (Python 3.13) (push) Successful in 19s
CI / Tests (Python 3.14) (push) Successful in 16s
CI / Type Checking (push) Successful in 11s
CI / Spelling (push) Successful in 9s
Audit / Dependencies (push) Successful in 8s
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 19s
CI / Tests (Python 3.13) (push) Successful in 19s
CI / Tests (Python 3.14) (push) Successful in 16s
CI / Type Checking (push) Successful in 11s
CI / Spelling (push) Successful in 9s
- owlbot.testing.plugin: fixtures that mirror ModuleLoader's wiring (module_context, module_lifecycle, command/event/route dispatchers, in-memory storage, real Config on a tmp YAML, HttpClient with aioresponses interception, and an aiohttp route_client). - owlbot.testing.helpers: make_user, make_chat_event, and factories for every Owncast event type, with sensible defaults. - owlbot.testing.stubs: RecordingOwncastClient and RecordingOwncastAdminClient that log each call to a .calls list in place of hitting the API. - pyproject.toml: added a 'testing' extra for downstream module authors (pytest, pytest-asyncio, pytest-aiohttp, aioresponses). - tests: migrated in-tree tests to the new helpers, moved module tests under tests/builtin_modules/, and swapped freezegun for time-machine.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# Copyright 2026 Logan Fick
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Testing utilities for Owlbot modules."""
|
||||
|
||||
from owlbot.testing.helpers import (
|
||||
make_chat_event,
|
||||
make_name_changed_event,
|
||||
make_stream_started_event,
|
||||
make_stream_status,
|
||||
make_stream_stopped_event,
|
||||
make_stream_title_updated_event,
|
||||
make_user,
|
||||
make_user_joined_event,
|
||||
make_user_parted_event,
|
||||
make_visibility_update_event,
|
||||
)
|
||||
from owlbot.testing.stubs import (
|
||||
RecordedCall,
|
||||
RecordingOwncastAdminClient,
|
||||
RecordingOwncastClient,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"RecordedCall",
|
||||
"RecordingOwncastAdminClient",
|
||||
"RecordingOwncastClient",
|
||||
"make_chat_event",
|
||||
"make_name_changed_event",
|
||||
"make_stream_started_event",
|
||||
"make_stream_status",
|
||||
"make_stream_stopped_event",
|
||||
"make_stream_title_updated_event",
|
||||
"make_user",
|
||||
"make_user_joined_event",
|
||||
"make_user_parted_event",
|
||||
"make_visibility_update_event",
|
||||
]
|
||||
Reference in New Issue
Block a user