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

Recommended package name for manifests and package managers such as Pixi:

revitdevtool_pytest

pip normalizes package names, so the following forms are equivalent when installing from PyPI:

pip install revitdevtool_pytest
pip install revitdevtool-pytest
pip install RevitDevTool.PyTest

The Python import/module name used by the package is:

import 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.3.tar.gz (12.6 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.3-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: revitdevtool_pytest-0.0.3.tar.gz
  • Upload date:
  • Size: 12.6 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.3.tar.gz
Algorithm Hash digest
SHA256 d9f639416251b5374c9e0a3dd36193a126d65f5db92ca5725a53fd5b42542971
MD5 3dcf87e73854068ac92087ea7da5f2a7
BLAKE2b-256 b4f51922f4bf7248dee1bd8541d4628448b7789e8747949294b8d6e7606c90f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for revitdevtool_pytest-0.0.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for revitdevtool_pytest-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d134a1a7270885e2a89076997acae6224042b8941c6e6683c5b9d0d3d1c4ce08
MD5 b27dc20bf6dfa10a98496f8b27d9a92b
BLAKE2b-256 35af2163233fbd2faa99a0fb8ebe7e578cc212d4d2f6e8cc6e1e0f4b363359a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for revitdevtool_pytest-0.0.3-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