def test_docs_input_output(rules_statements_output): from blessings import Terminal from docopt import docopt from luca import commandline rules_path, statement_paths, output_path = rules_statements_output terminal = Terminal(kind='ansi', force_styling=True) terminal._height_and_width = lambda: (24, 48) argv = ['tally', rules_path] + statement_paths if rules_path.endswith('t.yaml'): argv.append('-t') args = docopt(commandline.__doc__, argv) lines = list(commandline._main(args, terminal)) lines.append('') output = '\n'.join(lines) with open(output_path) as output_file: expected = output_file.read() assert expected == output