Skip to content

Commit e050ed2

Browse files
author
Jürgen Zornig
committed
feat(run): --render live DBFit-style page view
Single .test.md renders as a flowing document (prose + syntax-highlighted SQL + expected tables); each fixture card lights up green/red in place via rich.Live as the runner executes it, with the row diff inline on failure. chore(release): 0.3.1
1 parent f093e60 commit e050ed2

8 files changed

Lines changed: 440 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [0.3.1] — 2026-06-08
11+
12+
### Added
13+
14+
- **`--render` / `-r` — live page rendering (DBFit-browser style).** For a single
15+
`.test.md`, the page is rendered in the terminal (prose, syntax-highlighted SQL,
16+
expected tables) and each fixture card lights up green/red *in place* as it runs, with
17+
the row diff shown inline on failure. The closest terminal analogue to watching a DBFit
18+
wiki page execute in the browser.
19+
1020
## [0.3.0] — 2026-06-08
1121

1222
### Added
@@ -149,7 +159,8 @@ with code paths in place for SQL Server and Oracle.
149159
reject `python-oracledb` thin-mode authentication. Configuration is via
150160
`DBRESSION_ORACLE_CLIENT_LIB_DIR`.
151161

152-
[Unreleased]: https://github.com/angrydat/dbression/compare/v0.3.0...HEAD
162+
[Unreleased]: https://github.com/angrydat/dbression/compare/v0.3.1...HEAD
163+
[0.3.1]: https://github.com/angrydat/dbression/releases/tag/v0.3.1
153164
[0.3.0]: https://github.com/angrydat/dbression/releases/tag/v0.3.0
154165
[0.2.0]: https://github.com/angrydat/dbression/releases/tag/v0.2.0
155166
[0.1.2]: https://github.com/angrydat/dbression/releases/tag/v0.1.2

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ anywhere. `dbression` is a Python re-implementation in the spirit of the fantast
1515

1616
```text
1717
$ dbression run tests/
18-
dbression 0.3.0 — Suite: tests @ postgresql+psycopg://foo:***@db01/bar
18+
dbression 0.3.1 — Suite: tests @ postgresql+psycopg://foo:***@db01/bar
1919
2020
✓ HelloSql 0.004s
2121
CommonSuite/
@@ -242,6 +242,7 @@ dbression:
242242
```bash
243243
dbression run <suite-path> # run an entire (sub-)suite (a directory)
244244
dbression run <path>/MyTest.test.md # run a single test file (its SuiteSetUp/_root come along)
245+
dbression run <path>/MyTest.test.md -r # --render: live DBFit-style page, cards light up green/red
245246
dbression run <path> -d # --details: print each fixture green/red as it runs
246247
dbression run <path> --no-progress # disable the live spinner / x-of-y counter
247248
dbression run <path> -v # show every fixture table, not just the page line
@@ -259,6 +260,11 @@ A run shows a live spinner with an `x/y fixtures` counter and the currently-exec
259260
query (auto-disabled when piped or in CI). Add `-d`/`--details` to stream a colored
260261
pass/fail line per fixture — handy next to a `.test.md` you're previewing in `glow`.
261262

263+
For a single `.test.md`, `-r`/`--render` goes further: it renders the whole page in the
264+
terminal (prose, SQL, expected tables) and lights each fixture card up green or red **in
265+
place** as it runs — the terminal answer to watching a DBFit wiki page execute in the
266+
browser. You see exactly where a page breaks, in document context.
267+
262268
## Status
263269

264270
`dbression` is **WIP but already useful** — running production-scale DBFit suites today across

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dbression"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "Rage-quit your flaky DB regressions — modern, lightweight, multi-DB regression testing."
55
readme = "README.md"
66
license = { text = "MIT" }

src/dbression/cli.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ProgressObserver,
1616
make_progress,
1717
print_suite_result,
18+
render_run,
1819
write_json_report,
1920
write_junit_xml,
2021
)
@@ -67,6 +68,15 @@ def run(
6768
help="Print each fixture's result (green/red) live as it runs, DBFit-web-UI style",
6869
),
6970
] = False,
71+
render: Annotated[
72+
bool,
73+
typer.Option(
74+
"-r",
75+
"--render",
76+
help="Render a single .test.md page in the terminal, cards lighting up green/red "
77+
"in place as fixtures run (DBFit-browser style). Single .test.md file only.",
78+
),
79+
] = False,
7080
progress: Annotated[
7181
bool | None,
7282
typer.Option(
@@ -103,6 +113,13 @@ def run(
103113

104114
tag_filter = TagFilter(only=tuple(tag or ()), skip=tuple(skip_tag or ()))
105115

116+
if render and not (path.is_file() and path.name.endswith(".test.md")):
117+
console.print(
118+
"[red]--render works on a single .test.md file[/red] "
119+
"(it renders one page as a live document)."
120+
)
121+
raise typer.Exit(2)
122+
106123
if path.is_dir():
107124
suite = parse_suite(path)
108125
kind = "Suite"
@@ -128,7 +145,17 @@ def run(
128145
total = count_fixtures(suite, tag_filter)
129146

130147
try:
131-
if use_progress:
148+
if render:
149+
# Live DBFit-style page render — the document IS the output.
150+
result = render_run(
151+
console,
152+
suite,
153+
engine,
154+
source=path.read_text(encoding="utf-8"),
155+
commit_mode=commit_mode, # type: ignore[arg-type]
156+
tag_filter=tag_filter,
157+
)
158+
elif use_progress:
132159
with make_progress(console) as prog:
133160
task = prog.add_task("starting…", total=total or None)
134161
observer = ProgressObserver(console, prog, task, details=details)
@@ -151,7 +178,8 @@ def run(
151178
)
152179
finally:
153180
engine.dispose()
154-
print_suite_result(result, console, verbose=verbose)
181+
if not render:
182+
print_suite_result(result, console, verbose=verbose)
155183

156184
if junit_xml is not None:
157185
write_junit_xml(result, junit_xml)

src/dbression/report/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
from dbression.report.json_report import write_json_report
1010
from dbression.report.junit import write_junit_xml
1111
from dbression.report.progress import ProgressObserver, make_progress
12+
from dbression.report.render import render_run
1213

1314
__all__ = [
1415
"ProgressObserver",
1516
"make_progress",
1617
"print_suite_result",
18+
"render_run",
1719
"write_json_report",
1820
"write_junit_xml",
1921
]

0 commit comments

Comments
 (0)