Add color / non-color tests
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import contextlib
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
from hecate import Runner
|
||||
@@ -7,8 +8,11 @@ import babi
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def run(*args, **kwargs):
|
||||
def run(*args, color=True, **kwargs):
|
||||
cmd = (sys.executable, '-mcoverage', 'run', '-m', 'babi', *args)
|
||||
quoted = ' '.join(shlex.quote(p) for p in cmd)
|
||||
term = 'screen-256color' if color else 'screen'
|
||||
cmd = ('bash', '-c', f'export TERM={term}; exec {quoted}')
|
||||
with Runner(*cmd, **kwargs) as h:
|
||||
h.await_text(babi.VERSION_STR)
|
||||
yield h
|
||||
@@ -24,6 +28,12 @@ def await_text_missing(h, text):
|
||||
raise AssertionError(f'Timeout while waiting for text {text!r} to appear')
|
||||
|
||||
|
||||
def test_can_start_without_color():
|
||||
with run(color=False) as h:
|
||||
h.press('C-x')
|
||||
h.await_exit()
|
||||
|
||||
|
||||
def test_window_bounds(tmpdir):
|
||||
f = tmpdir.join('f.txt')
|
||||
f.write(f'{"x" * 40}\n' * 40)
|
||||
|
||||
Reference in New Issue
Block a user