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.2.tar.gz (12.2 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.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: revitdevtool_pytest-0.0.2.tar.gz
  • Upload date:
  • Size: 12.2 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.2.tar.gz
Algorithm Hash digest
SHA256 4990d8a5af6933346e7582cc24eb76e9eeb8e9ff642f60f6a80ddc687412b675
MD5 e805a2dad3b399f98ccd78744d869305
BLAKE2b-256 a424cb47aea59d30d24e720ce02f3b115e2d31a499049a6d44bf03e8d31730c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for revitdevtool_pytest-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 10b5932e58991aa8cb5dc6f3e08f5b688c90a300a389c1af154c038abfa86e0f
MD5 53646b935796e41ebcebb813ea6711df
BLAKE2b-256 1ad77c9a34e9ea2cf84b2bee4fc2bd094a4cffcbed49a9123710ef794d58c751

See more details on using hashes here.

Provenance

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