A simple plugin to use with pytest
Project description
pytest-inline is a plugin for pytest that writes inline tests.
Installation and usage
Use pip install pytest-inline to install our Python pytest-plugin
Use pytest . to run all inline tests in working directory
Use pytest {filename} to run all inline tests in a Python file
API
Declaration an inline test
- Here(test_name, parameterized, repeated, tag, disabled, timeout):
test_name is a string that represents the name of the test. The default value is the file name + line number of the test statement.
parameterized is a boolean value that indicates whether the test is parameterized. The default value is false.
repeated is an integer that indicates how many times the test is repeated. The default value is 1.
tag is a string that represents the tag of the test. The default value is an empty string.
disabled is a boolean value that indicates whether the test is disabled. The default value is false.
timeout is an integer that represents the timeout of the test. The default value is -1.
Provide test inputs
- given(variable, value):
assign the value to the variable.
Specify test oracles
- check_eq(actual_value, expected_value):
check if the actual value is equal to the expected value.
- check_neq(actual_value, expected_value):
check if the actual value is not equal to the expected value.
- check_true(expr):
check if the boolean expression is true.
- check_false(expr):
check if the boolean expression is false.
- check_none(variable):
check if the variable is none.
- check_not_none(variable):
check if the variable is not none.
- check_same(actual_value, expected_value):
check if the actual value and the expected value refer to the same object.
- check_not_same(actual_value, expected_value):
check if the actual value and the expected value refer to different objects.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_inline-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 076901f6bf0bb5a7d32919b119b52dea1c4106f5bcec4e38fd26256b5006bfc7 |
|
MD5 | 25a324c68fc7a0b9bc89c842b077de57 |
|
BLAKE2b-256 | 26a02ce358205f12760cb0b32a9133b17c3b0d514af94d1d140ef450363a958b |