feat(pytest-plugin): add plugin hooks and markers
Register text_validation marker via pytest_configure hook.
This commit is contained in:
22
src/veritext/pytest_plugin/__init__.py
Normal file
22
src/veritext/pytest_plugin/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Pytest plugin for text validation.
|
||||
|
||||
This plugin provides native pytest integration for Veritext, enabling
|
||||
text validation assertions in test suites.
|
||||
|
||||
Example:
|
||||
>>> from veritext.pytest_plugin import validate_text
|
||||
>>>
|
||||
>>> def test_summary_quality():
|
||||
... text = "The quick brown fox jumps over the lazy dog."
|
||||
... validate_text(
|
||||
... text,
|
||||
... min_length=10,
|
||||
... max_length=100,
|
||||
... max_reading_grade=8.0,
|
||||
... )
|
||||
"""
|
||||
|
||||
from veritext.pytest_plugin.assertions import validate_text
|
||||
from veritext.pytest_plugin.plugin import pytest_configure
|
||||
|
||||
__all__ = ["pytest_configure", "validate_text"]
|
||||
18
src/veritext/pytest_plugin/plugin.py
Normal file
18
src/veritext/pytest_plugin/plugin.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Pytest hooks for Veritext plugin."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_configure(config: "pytest.Config") -> None:
|
||||
"""Register Veritext markers.
|
||||
|
||||
Args:
|
||||
config: Pytest configuration object.
|
||||
"""
|
||||
config.addinivalue_line(
|
||||
"markers",
|
||||
"text_validation: mark test as a text validation test",
|
||||
)
|
||||
Reference in New Issue
Block a user