Read and write each record through the store its config names, and open one for agents with project-record
CI / tests (pull_request) Successful in 2m14s
CI / tests (pull_request) Successful in 2m14s
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Record stores for tests, held to record_store.contract like every backend."""
|
||||
import dataclasses
|
||||
|
||||
from failure import Failure
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class MemoryStore:
|
||||
"""A record held in memory, as a backend outside git holds one. Set fails to make every read and write fail with that reason."""
|
||||
text: str = ""
|
||||
label: str = "the record in memory"
|
||||
tracked: str | None = None
|
||||
fails: str | None = None
|
||||
|
||||
def read(self) -> str | Failure:
|
||||
return Failure(self.fails) if self.fails else self.text
|
||||
|
||||
def write(self, text: str) -> Failure | None:
|
||||
if self.fails:
|
||||
return Failure(self.fails)
|
||||
self.text = text
|
||||
return None
|
||||
Reference in New Issue
Block a user