8000 Alpha TUI round 2 and release hardening for 0.6.0 by rafatahmed · Pull Request #148 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/flahax/mix_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ 8000 -25,6 +25,7 @@
options_for,
output_folder,
saved_line,
summarize,
write_sheets,
)
from .terminal import Terminal, TerminalUnavailable, glyphs
Expand Down Expand Up @@ -494,6 +495,7 @@ def run_tui(store, session_name, output_arg, term_factory=Terminal, encoding=Non
summary, ahead = calculate(prompts, lambda: run_batch(options_for(store, session)))
output = output_folder(output_arg, name)
files = write_sheets(summary, session, output)
summarize(summary, lines.append) # the recipe stays in the terminal after the screen
lines.append(f'Wrote {", ".join(files)} to {output}')
try:
show_results(term, g, summary, output, ahead)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_mix_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,14 @@ def test_run_tui_end_to_end(self):
)
self.assertTrue(lines[0].startswith('Saved the answers as '), lines)
self.assertTrue(lines[-1].startswith('Wrote batch-sheet.html, summary.json'), lines)
# 147: the recipe stays in the terminal, as the line mode prints it.
from flahax.mix_cli import summarize

recipe = []
summarize(self.summary, recipe.append)
self.assertEqual(lines[1:-1], recipe)
self.assertTrue(any(line.startswith('Tank A: prepare') for line in recipe))
self.assertTrue(any(line.startswith('Acid container:') for line in recipe))
shown = ['\n'.join(f) for f in term.frames]
self.assertTrue(any('Calculating the recipe, pH and tanks' in f for f in shown))
self.assertTrue(any('From water' in f for f in shown))
Expand Down
Loading
0