-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecker.py
28 lines (23 loc) · 1.01 KB
/
checker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Checker(object):
"""Checkers are stored within the TestRunner and set up expectations about the test
command outputs.
Checkers are characterized by a triplet of boolean, asserting whether:
- they expect something from exitcode
- they expect something from stdout
- they expect something from stderr
This is helpful to avoid inserting inconsistent expectations into the TestRunner.
To subclass:
- implement `self.check()`
- set up `self.expecting_*` flag(s)
- make sure `self.context` is available to produce useful failure reports.
"""
_expectations = ("code", "stdout", "stderr")
expecting_code = False
expecting_stdout = False
expecting_stderr = False
def __init__(self, context):
"""Trivial default."""
self.context = context
def check(self, test_runner, code, stdout, stderr) -> None or str:
"""Verify that output code is conforming, otherwise produce an error report."""
return None