tessl install tessl/pypi-allure-python-commons@2.15.0Contains the API for end users as well as helper functions and classes to build Allure adapters for Python test frameworks
Agent Success
Agent success rate when using this tile
94%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.27x
Baseline
Agent success rate without this tile
74%
A comprehensive Python library providing the core API and infrastructure for creating Allure test adapters. It offers a complete object model for Allure Report generation, lifecycle management for test execution tracking, and both file-based and memory-based logging implementations for emitting test results, containers, and attachments. Designed for maximum reusability across Python testing frameworks.
pip install allure-python-commonsimport allureFor adapter development:
import allure_commonsimport allure
# Basic test enhancement with decorators
@allure.title("Test user authentication")
@allure.description("Verify that users can authenticate with valid credentials")
@allure.severity(allure.severity_level.CRITICAL)
@allure.feature("Authentication")
@allure.story("User Login")
def test_user_login():
# Test implementation
with allure.step("Enter username"):
enter_username("testuser")
with allure.step("Enter password"):
enter_password("secret123")
with allure.step("Click login button"):
click_login()
# Attach screenshot on failure
allure.attach(
screenshot_bytes,
name="Login failure screenshot",
attachment_type=allure.attachment_type.PNG
)
# Dynamic test modification at runtime
def test_dynamic_enhancement():
allure.dynamic.title("Dynamic test title")
allure.dynamic.description("Added description at runtime")
allure.dynamic.label("owner", "test-team")
allure.dynamic.link("https://issues.example.com/BUG-123", "Bug Report")The allure-python-commons library is built on a plugin-based architecture that provides maximum flexibility and extensibility:
This design enables the library to serve as the foundation for multiple Python testing framework adapters (pytest, behave, nose2, robotframework) while maintaining consistency in Allure report generation.
Comprehensive set of decorators for enhancing test metadata including titles, descriptions, labels, severities, links, and organizational markers like epics, features, and stories.
def title(test_title): ...
def description(test_description): ...
def severity(severity_level): ...
def feature(*features): ...
def story(*stories): ...
def epic(*epics): ...
def tag(*tags): ...
def manual(fn): ...
def link(url, link_type=LinkType.LINK, name=None): ...
def issue(url, name=None): ...
def testcase(url, name=None): ...
class Dynamic:
@staticmethod
def parameter(name, value, excluded=None, mode=None): ...Context managers and classes for managing test execution phases, including test cases, fixtures, steps, and containers with proper lifecycle tracking.
def step(title): ...
def attach(body, name=None, attachment_type=None, extension=None): ...
class Attach:
@staticmethod
def file(source, name=None, attachment_type=None, extension=None): ...
class AllureLifecycle:
def schedule_test_case(self, uuid=None): ...
def start_step(self, parent_uuid=None, uuid=None): ...
def start_container(self, uuid=None): ...
def start_before_fixture(self, parent_uuid=None, uuid=None): ...
def start_after_fixture(self, parent_uuid=None, uuid=None): ...Complete set of data structures for representing Allure test results, containers, attachments, and metadata with proper serialization support.
class TestResult(ExecutableItem):
uuid: str
labels: List[Label]
links: List[Link]
status: str
class TestResultContainer:
uuid: str
befores: List[TestBeforeResult]
afters: List[TestAfterResult]Hook-based plugin architecture enabling extensible test reporting with separate hooks for end users and adapter developers.
@hookspec
def decorate_as_title(test_title): ...
@hookspec
def start_test(parent_uuid, uuid, name, parameters, context): ...
plugin_manager = PluginManager('allure')Helper functions for UUID generation, timestamp management, parameter extraction, string formatting, and platform detection.
def uuid4() -> str: ...
def now() -> int: ...
def func_parameters(func, *args, **kwargs) -> OrderedDict: ...
def represent(item) -> str: ...class Severity:
BLOCKER = 'blocker'
CRITICAL = 'critical'
NORMAL = 'normal'
MINOR = 'minor'
TRIVIAL = 'trivial'
class ParameterMode:
HIDDEN = 'hidden'
MASKED = 'masked'
DEFAULT = None
class AttachmentType:
# Text formats
TEXT = 'text/plain'
JSON = 'application/json'
XML = 'application/xml'
HTML = 'text/html'
CSV = 'text/csv'
# Image formats
PNG = 'image/png'
JPG = 'image/jpeg'
SVG = 'image/svg+xml'
# Video formats
MP4 = 'video/mp4'
WEBM = 'video/webm'
# Document formats
PDF = 'application/pdf'