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
Holderto contain expected, actual, and total values.Enumerate over parsed
Readmeand populate the three containers.Expected
listfrom 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
listcontains nothing even though command output was captured.
readmetester.exceptions¶
- exception readmetester.exceptions.DocumentError[source]¶
Bases:
ExceptionBase for error for all documentation.
- exception readmetester.exceptions.OutputDocumentError(code_block: str, message: str)[source]¶
Bases:
DocumentErrorBase 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:
OutputDocumentErrorOutput 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:
OutputDocumentErrorActual 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:
OutputDocumentErrorOutput 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:
DocumentErrorBase for errors resulting from invalid document syntax.