readmetester¶
readmetester¶
Parse, test, and assert RST code-blocks
- readmetester.main(path: Optional[Union[str, Path]] = None) None [source]¶
Parse README from commandline argument.
Initialize
Holder
to contain expected, actual, and total values.Enumerate over parsed
Readme
and populate the three containers.Expected
list
from the README file directlyActual from the actual command output
Total with a combination of both plus code-block headings
Run assertions on the actual and expected commands and print output from the total
list
.Clear and initialize base key-values on each iteration.
If no errors are raised then print that the README is a success and there are no errors in testing.
- Parameters:
path – Path to README.
- Raises:
OutputDocumentError – Raise if the expected
list
contains nothing even though command output was captured.
readmetester.exceptions¶
- exception readmetester.exceptions.DocumentError[source]¶
Bases:
Exception
Base for error for all documentation.
- exception readmetester.exceptions.OutputDocumentError(code_block: str, message: str)[source]¶
Bases:
DocumentError
Base for errors resulting from incorrectly documented code.
- Parameters:
code_block – Code block that error is raised for.
message – Error message.
- exception readmetester.exceptions.OutputExpectedError(code_block: str, expected: str)[source]¶
Bases:
OutputDocumentError
Output was not provided, but output is expected.
- Parameters:
code_block – Code block that error is raised for.
expected – Expected output.
- exception readmetester.exceptions.OutputNotEqualError(code_block: str, actual: str, expected: str)[source]¶
Bases:
OutputDocumentError
Actual code not equal to expected code.
- Parameters:
code_block – Code block that error is raised for.
actual – Actual output produced.
expected – Expected output.
- exception readmetester.exceptions.OutputNotExpectedError(code_block: str, actual: str)[source]¶
Bases:
OutputDocumentError
Output was provided, but no output is expected.
- Parameters:
code_block – Code block that error is raised for.
actual – Actual output produced.
- exception readmetester.exceptions.SyntaxDocumentError[source]¶
Bases:
DocumentError
Base for errors resulting from invalid document syntax.