Files
dockipelago/worlds/brotato/test/__init__.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

35 lines
1.0 KiB
Python

from contextlib import contextmanager
from typing import Any, ClassVar
from test.bases import WorldTestBase
from .. import BrotatoWorld
from .data_sets.base import BrotatoTestDataSet
class BrotatoTestBase(WorldTestBase):
game = "Brotato"
world: BrotatoWorld # type: ignore
player: ClassVar[int] = 1
@contextmanager
def data_set_subtest(self, data_set: BrotatoTestDataSet, **kwargs):
with self.subTest(msg=data_set.test_name, **kwargs), self._run(data_set.options_dict):
yield
@contextmanager
def _run(self, run_options: dict[str, Any]):
"""Setup the world using the options from the dataset.
We make this distinct from setUp() so tests can call this from subTests when
iterating overt TEST_DATA_SETS.
"""
original_options = self.options
self.options = {**original_options, **run_options}
try:
self.setUp()
yield
finally:
# self.tearDown()
self.options = original_options