example/example_5.pyPython34 lines
example_5.py
Python test suites and the implemented page-integrity check
example/example_5.py
Pythonimport asyncio
import sqlite3
from contextlib import closing
from pathlib import Path
from tempfile import TemporaryDirectory
import storq
def main() -> None:
with TemporaryDirectory() as directory:
database = Path(directory) / "test.sqlite"
with closing(sqlite3.connect(database)) as connection:
connection.execute("CREATE TABLE sample (id INTEGER PRIMARY KEY)")
suite = storq.TestSuite("format checks")
suite.add(storq.page_integrity())
result = asyncio.run(
suite.run(context={"database": str(database)})
)
print("Passed:", result.passed)
print("Failed:", result.failed)
print("Skipped:", result.skipped)
print("Case details:", result.results)
print(
"Only page_integrity performs a native inspection; "
"other built-in reliability factories are placeholders.",
)
if __name__ == "__main__":
main()
