feat: rewrite core layer (errors, template, paths, platform, console, runtime, config)
Complete rewrite of all core modules with proper abstractions:
- FlowError hierarchy with PlanConflict and ExecutionError
- Pure template substitution ($VAR, ${VAR}, {{expr}})
- XDG path constants
- Frozen PlatformInfo dataclass with context detection
- Console with color/quiet/TTY support
- Runtime primitives (CommandRunner, FileSystem, GitClient, SystemRuntime)
- Config loading with target parsing and manifest merging
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
38
tests/test_core_console.py
Normal file
38
tests/test_core_console.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Tests for flow.core.console."""
|
||||
|
||||
from flow.core.console import Console
|
||||
|
||||
|
||||
def test_info_prints_message(capsys):
|
||||
c = Console(color=False)
|
||||
c.info("hello")
|
||||
assert "hello" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_quiet_suppresses_info(capsys):
|
||||
c = Console(quiet=True, color=False)
|
||||
c.info("hidden")
|
||||
assert capsys.readouterr().out == ""
|
||||
|
||||
|
||||
def test_quiet_does_not_suppress_error(capsys):
|
||||
c = Console(quiet=True, color=False)
|
||||
c.error("visible")
|
||||
captured = capsys.readouterr()
|
||||
assert "visible" in captured.err or "visible" in captured.out
|
||||
|
||||
|
||||
def test_table_prints_headers_and_rows(capsys):
|
||||
c = Console(color=False)
|
||||
c.table(["NAME", "STATUS"], [["foo", "ok"], ["bar", "fail"]])
|
||||
output = capsys.readouterr().out
|
||||
assert "NAME" in output
|
||||
assert "foo" in output
|
||||
assert "bar" in output
|
||||
|
||||
|
||||
def test_no_color_strips_ansi(capsys):
|
||||
c = Console(color=False)
|
||||
c.info("test")
|
||||
output = capsys.readouterr().out
|
||||
assert "\033[" not in output
|
||||
Reference in New Issue
Block a user