Skip to main content

Shared components for Proofy Python testing framework integrations

Project description

Proofy Commons

Shared components for Proofy Python testing framework integrations.

Overview

proofy-commons provides the foundational components used by all Proofy framework adapters.

Only the functions re-exported from proofy are part of the public API. Everything else is considered internal and may change without notice.

Installation

pip install proofy

Public API (from proofy)

These are the only supported, stable entry points:

from proofy import (
    # Metadata
    set_name, set_description, set_severity,
    add_tag, add_tags, add_attributes,
    set_run_name,

    # Run-level metadata
    set_run_attribute, add_run_attributes, get_run_attributes,

    # Attachments
    add_attachment, add_data

    # Context info
    get_current_run_id, get_current_test_id,

    # Decorators
    name, title, description, severity, tags, attributes,
)

Examples

Runtime usage

from proofy import add_attachment, set_description, add_attributes

def test_example():
    set_description("This test validates user authentication")
    add_attributes(severity="critical", component="auth")
    # ... your test ...
    add_attachment("screenshot.png", name="success_screenshot")

Decorators

from proofy import name, description, severity, tags, attributes

@name("User Authentication Test")
@description("Validates login functionality with various scenarios")
@severity("critical")
@tags("auth", "smoke")
@attributes(component="auth", area="login")
def test_user_authentication():
    pass

Run Attributes

Run attributes allow you to add metadata to the entire test run (not individual tests):

import proofy

# Set individual run attribute
proofy.set_run_attribute("environment", "production")

# Set multiple run attributes at once
proofy.add_run_attributes(
    version="1.2.3",
    build_number="456",
    branch="main",
    tested_by="CI"
)

# Get all run attributes
attrs = proofy.get_run_attributes()
print(attrs)  # {'environment': 'production', 'version': '1.2.3', ...}

Note: Run attributes should be set before or during session start (e.g., in conftest.py for pytest). The system also automatically collects system information like Python version, OS, and framework version.

Architecture

Internal structure includes clients, models, hooks, context, I/O, and export utilities that support the public API. These are subject to change and are not part of the stable surface.

Notes

  • The HTTP client, models, hooks, and other internals are intentionally undocumented here.
  • Use the framework plugins (e.g., pytest-proofy) for integration and configuration options.

Runtime API

Metadata Functions

def set_name(name: str, test_id: Optional[str] = None) -> None
def set_description(description: str, test_id: Optional[str] = None) -> None
def set_severity(severity: str, test_id: Optional[str] = None) -> None
def add_attributes(test_id: Optional[str] = None, **kwargs: Any) -> None
def add_tag(tag: str, test_id: Optional[str] = None) -> None
def add_tags(tags: List[str], test_id: Optional[str] = None) -> None

Attachment Functions

def add_attachment(
    file: Union[str, Path],
    *,
    name: str,
    mime_type: Optional[str] = None,
    test_id: Optional[str] = None,
) -> None
def add_data(
    data: str | bytes | bytearray | dict[str, Any],
    *,
    name: str,
    mime_type: Optional[str] = None,
    extension: Optional[str] = None,
    artifact_type: ArtifactType | int = ArtifactType.ATTACHMENT,
    encoding: str = "utf-8",
) -> None

Development

Setup

git clone <repository>
cd proofy-python/proofy-commons
uv venv .venv
source .venv/bin/activate
uv pip install -e '.[dev]'

Testing

# Run tests
uv run -q pytest

# Run with coverage
uv run -q pytest --cov=proofy --cov-report=html

# Type checking
uv run -q mypy proofy

# Linting and formatting
uv run -q ruff check --fix
uv run -q ruff format

License

Apache-2.0 — see LICENSE file for details.

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

proofy_python-0.1.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proofy_python-0.1.0-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file proofy_python-0.1.0.tar.gz.

File metadata

  • Download URL: proofy_python-0.1.0.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for proofy_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32293f13530cd78b8d20251ed99d3d5cb193430680d395feda4588338f06bf50
MD5 43a688ecea363533741e76b4628c3de0
BLAKE2b-256 98fe8710af7d25813d168ad5dc8c848a45432cafdc28458d1203045cb09a6baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for proofy_python-0.1.0.tar.gz:

Publisher: release.yml on getproofy/proofy-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file proofy_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: proofy_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for proofy_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2ef959e763d09ca11bd1c5c11350461a7ee12aa3965d0887a9ad8e03104efb0
MD5 ee509314fdd16141ff566e0ebc13701a
BLAKE2b-256 d1a2480c484f527d36470fb18cd6d8b50efd1286902f4224c39e9db55b3224a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for proofy_python-0.1.0-py3-none-any.whl:

Publisher: release.yml on getproofy/proofy-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page