API Reference¶
inline_tests¶
Inline tests for Python — colocate tests with implementation, Rust-style.
MARKER = '__inline_test__'
module-attribute
¶
Attribute name set on decorated test functions/classes.
test(obj=None, *, reason=None)
¶
Mark a function or class as an inline test.
Source code in src/inline_tests/__init__.py
Decorator¶
test¶
Marks a function or class as an inline test.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
reason |
str |
No | Documentation for why the test exists |
Returns: The original function, unchanged except for a marker attribute.
it¶
Alias for test. Use for BDD-style test names:
Constants¶
MARKER¶
The attribute name set on decorated functions. Used internally by the plugin for collection.
version¶
Package version string, read from package metadata.
Plugin hooks¶
The plugin registers these pytest hooks:
pytest_addoption- Adds--inline-testsflagpytest_collect_file- Collects@test-decorated items from non-test filespytest_collection_modifyitems- Deduplicates items between collectors