Skip to main content

pytest plugin for testing Revit API code via RevitDevTool Named Pipe bridge

Project description

RevitDevTool.PyTest

PyPI version Python License: MIT

pytest plugin for testing Revit API code via RevitDevTool Named Pipe bridge. Tests run inside a live Revit process — write standard pytest, execute remotely.

Installation

pip install RevitDevTool.PyTest

Dependencies

Package Version
Python >= 3.10
pytest >= 9.0
pywin32 >= 311

Requirements

  • Windows (Named Pipes)
  • Revit with RevitDevTool add-in installed

Usage

def test_revit_version():
    app = __revit__.Application
    assert "2025" in app.VersionName
# Auto-detect running Revit 2025
pytest --revit-version=2025 -v

# Auto-launch Revit 2025 if not running
pytest --revit-launch --revit-version=2025 -v

CLI Options

Option Description
--revit-version Revit version year (e.g. 2025). Required with --revit-launch.
--revit-launch Auto-launch Revit if no running instance found.
--revit-timeout Per-test timeout in seconds (default: 60).
--revit-launch-timeout Revit startup timeout in seconds (default: 120).
--revit-pipe Explicit pipe name (bypasses auto-discovery).

How It Works

  1. pytest discovers tests locally as usual
  2. The plugin intercepts test execution via pytest_pyfunc_call
  3. Test source code is serialized and sent over Named Pipe to Revit
  4. RevitDevTool add-in executes the test inside Revit's Python (pythonnet) environment
  5. Results are mapped back to pytest pass/fail/skip

VSCode Integration

Add to .vscode/settings.json:

{
    "python.testing.pytestEnabled": true,
    "python.testing.pytestArgs": [
        "--revit-launch",
        "--revit-version=2025",
        "tests"
    ]
}

License

MIT

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

revitdevtool_pytest-0.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

revitdevtool_pytest-0.0.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file revitdevtool_pytest-0.0.1.tar.gz.

File metadata

  • Download URL: revitdevtool_pytest-0.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for revitdevtool_pytest-0.0.1.tar.gz
Algorithm Hash digest
SHA256 104286ec2f16e5125dc070cd80bfb81474a191a0af182d9f11eac22262118032
MD5 ef7817c7aaf4ad38b2e0cb74473fdf71
BLAKE2b-256 c922c3318bb2fd81e09e7cc30935609bc9620ef55d7e8182bfdc8d61c9aca16f

See more details on using hashes here.

Provenance

The following attestation bundles were made for revitdevtool_pytest-0.0.1.tar.gz:

Publisher: publish.yml on trgiangv/RevitDevTool.PyTest

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

File details

Details for the file revitdevtool_pytest-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for revitdevtool_pytest-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c942df9ac5fbd3be75d859a12746bf63ad41d793665b32564bbbaa3621f4329b
MD5 dd3b6155b1a558fea5e794917cda6f5d
BLAKE2b-256 81e7d66b0c2f6dc12dde1e108c5f86594ad597fd3cc2fa95cfe468d479ee4ed4

See more details on using hashes here.

Provenance

The following attestation bundles were made for revitdevtool_pytest-0.0.1-py3-none-any.whl:

Publisher: publish.yml on trgiangv/RevitDevTool.PyTest

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