test_code_style¶
test code extends prod code style¶
Apply rules from prod_code_style.
given when then¶
When writing tests, use markers: given, when, then.
Put comments (if any) after on a separate (next) line after the marker. Separate each marker by an empty line before and after.
# given:
# when:
# then:
pytest-style¶
Use pytest-style tests without test classes.
use @patch for mocks¶
Instead of using with to define mocks, for example:
with patch("sys.argv", [""]):
pass
use @patch decorator at the function definition for mocks:
@patch("sys.argv", [""])
def test_function():
pass