devkit_ui.missions.test_yaml

Functions

coerce(raw)

Run _coerce_record with its stdout warnings suppressed.

Classes

NoDiskYamlStore(path, on_write_done)

MissionYamlStore whose background writer never touches the disk.

TestCoerceRecord([methodName])

TestMissionYamlStore([methodName])

In-memory behaviour; nothing is written to disk.

TestMissionYamlStorePersistence([methodName])

Real writes.

class devkit_ui.missions.test_yaml.NoDiskYamlStore(path: str, on_write_done: Callable[[str], None])[source]

Bases: MissionYamlStore

MissionYamlStore whose background writer never touches the disk.

Every mutation queues a write to a daemon thread that outlives the test. Overriding the writer, rather than patching it for the duration of a test, means a late write can never recreate a temporary directory that has already been cleaned up.

class devkit_ui.missions.test_yaml.TestCoerceRecord(methodName='runTest')[source]

Bases: TestCase

test_full_record_is_preserved() → None[source]
test_malformed_fields_are_reset_instead_of_dropping_the_record() → None[source]
test_minimal_record_gets_safe_defaults() → None[source]
test_missing_or_non_string_id_is_skipped() → None[source]
test_non_dict_record_is_skipped() → None[source]
class devkit_ui.missions.test_yaml.TestMissionYamlStore(methodName='runTest')[source]

Bases: TestCase

In-memory behaviour; nothing is written to disk.

setUp() → None[source]

Hook method for setting up the test fixture before exercising it.

test_add_allocates_the_lowest_free_id() → None[source]
test_attach_loads_valid_records_and_skips_invalid_ones() → None[source]
test_attach_with_unreadable_yaml_logs_a_warning() → None[source]
test_attach_without_file_leaves_store_empty() → None[source]
test_find_and_find_by_name() → None[source]
test_update_replaces_fields_on_the_matching_mission_only() → None[source]
class devkit_ui.missions.test_yaml.TestMissionYamlStorePersistence(methodName='runTest')[source]

Bases: TestCase

Real writes. Each test triggers exactly one write and waits for it.

on_write_done(message: str) → None[source]
setUp() → None[source]

Hook method for setting up the test fixture before exercising it.

test_added_mission_is_written_to_disk_and_reloads_in_a_new_store() → None[source]
test_write_failure_is_reported_through_the_callback() → None[source]
test_write_is_atomic_and_leaves_no_temporary_file() → None[source]
wait_for_write() → None[source]
devkit_ui.missions.test_yaml.coerce(raw: object) → dict | None[source]

Run _coerce_record with its stdout warnings suppressed.