Parsers
Parsers are used to obtain data chunks from collectors in order to convert them into test suites and cases.
- class pyetta.parsers.Parser
Pyetta parser stage.
The parser stage is fed the input from a collector in the form of bytes.
- RESERVED_TEST_GROUP = 'pyetta.parser'
Special test suite for pyetta parser specific errors. If any parser encounters an error, they should create a failed test case within the suite.
- abstract feed_data(data_chunk: bytes) None
Feeds a data chunk to the parser.
- Parameters
data_chunk – A chunk of data to parse. This chunk should be complete it itself.
- abstract stop(forced: bool = False) None
Stops the parser and forces a completion. Called by the executor when the collection is stopped.
- Parameters
forced – Set to true to stop due to an error.
If stopped before parse completion the parser must add a failed test indicating a forced stopped.
- abstract property done: bool
Gets whether the parser is done or not.
- Returns
True if parser is done (parser errors are communicated via the test suites).
- property test_cases: List[pyetta.parser_data.TestCase]
The parsed test cases up to this point. Note this may be incomplete if called before the parser is stopped.
- Returns
A list of parsed test suites.
Implementations
The pyetta library comes with some default parsers for use that can interpret output from various unit testing programs.
- class pyetta.parsers.UnityParser(name: Optional[str] = None, encoding: str = 'ascii')
Bases:
pyetta.parsers.Parser