import vroom.controls import vroom.test from vroom.result import Result # Pylint is not smart enough to notice that all the exceptions here inherit from # vroom.test.Failure, which is a standard Exception. # pylint: disable-msg=nonstandard-exception VROOMFILE_VAR = 'VROOMFILE' VROOMDIR_VAR = 'VROOMDIR' LOG_FILENAME_VAR = 'VROOM_SHELL_LOGFILE' CONTROL_FILENAME_VAR = 'VROOM_SHELL_CONTROLLFILE' ERROR_FILENAME_VAR = 'VROOM_SHELL_ERRORFILE' CONTROL = vroom.Specification(EXPECT='expect', RESPOND='respond') STRICTNESS = vroom.Specification(STRICT='STRICT', RELAXED='RELAXED') OUTCHANNEL = vroom.Specification(COMMAND='command', STDOUT='stdout', STDERR='stderr', STATUS='status') DEFAULT_MODE = vroom.controls.MODE.REGEX def Load(filename): """Loads a shell file into python space. Args:
"""A module to keep track of vim messages.""" import re import vroom import vroom.controls import vroom.test # Pylint is not smart enough to notice that all the exceptions here inherit from # vroom.test.Failure, which is a standard Exception. # pylint: disable-msg=nonstandard-exception ERROR_GUESS = re.compile( r'^(E\d+\b|ERR(OR)?\b|Error detected while processing .*)') STRICTNESS = vroom.Specification(STRICT='STRICT', RELAXED='RELAXED', ERRORS='GUESS-ERRORS') DEFAULT_MODE = vroom.controls.MODE.VERBATIM def GuessNewMessages(old, new): """Guess which messages in a message list are new. >>> GuessNewMessages([1, 2, 3, 4], [1, 2, 3, 4, 5, 6, 7]) [5, 6, 7] >>> GuessNewMessages([1, 2, 3, 4], [4, 5, 6, 7]) [5, 6, 7] >>> GuessNewMessages([1, 2, 3, 4], [5, 6, 7]) [5, 6, 7] >>> GuessNewMessages([1, 2, 3, 4], [4, 1, 2, 3]) [1, 2, 3]
"""Vroom test utilities.""" import fnmatch import re import traceback import vroom import vroom.controls RESULT = vroom.Specification(PASSED='passed', ERROR='error', FAILED='failed', SENT='sent') LOG = vroom.Specification(RECEIVED='received', MATCHED='matched', RESPONDED='responded', UNEXPECTED='unexpected', ERROR='error') def IsBad(result): """Whether or not a result is something to worry about. >>> IsBad(RESULT.PASSED) False >>> IsBad(RESULT.FAILED) True Args: result: The RESULT. Returns:
"""Vroom action parsing (actions are different types of vroom lines).""" import vroom import vroom.controls ACTION = vroom.Specification(COMMENT='comment', PASS='******', INPUT='input', COMMAND='command', TEXT='text', CONTINUATION='continuation', DIRECTIVE='directive', MESSAGE='message', SYSTEM='system', HIJACK='hijack', OUTPUT='output') DIRECTIVE = vroom.Specification(CLEAR='clear', END='end', MESSAGES='messages', SYSTEM='system') DIRECTIVE_PREFIX = ' @' EMPTY_LINE_CHECK = ' &' # The number of blank lines that equate to a @clear command. # (Set to None to disable). BLANK_LINE_CLEAR_COMBO = 3 UNCONTROLLED_LINE_TYPES = { ACTION.CONTINUATION: ' |', }
"""Vroom control block parsing.""" import re import vroom # Pylint is not smart enough to notice that all the exceptions here inherit from # vroom.test.Failure, which is a standard Exception. # pylint: disable-msg=nonstandard-exception OPTION = vroom.Specification( BUFFER='buffer', RANGE='range', MODE='mode', DELAY='delay', MESSAGE_STRICTNESS='messages', SYSTEM_STRICTNESS='system', OUTPUT_CHANNEL='channel') MODE = vroom.Specification( REGEX='regex', GLOB='glob', VERBATIM='verbatim') SPECIAL_RANGE = vroom.Specification( CURRENT_LINE='.') REGEX = vroom.Specification( BUFFER_NUMBER=re.compile(r'^(\d+)$'), RANGE=re.compile(r'^(\.|\d+)?(?:,(\+)?(\$|\d+)?)?$'), MODE=re.compile(r'^(%s)$' % '|'.join(MODE.Values())), DELAY=re.compile(r'^(\d+(?:\.\d+)?)s?$'),
import vroom import vroom.buffer import vroom.color import vroom.controls import vroom.messages import vroom.shell import vroom.test import vroom.vim # In lots of places in this file we use the name 'file' to mean 'a file'. # We do this so that Logger.Print can have an interface consistent with # python3's print. # pylint: disable-msg=redefined-builtin STATUS = vroom.Specification(PASS='******', ERROR='ERROR', FAIL='FAIL') COLORS = { STATUS.PASS: vroom.color.GREEN, STATUS.ERROR: vroom.color.YELLOW, STATUS.FAIL: vroom.color.RED, } class Writer(object): """An output writer for a single vroom test file.""" def __init__(self, filename, args): """Creatse the writer. Args: filename: The file to be tested.