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
import revitdevtool_pytest

Dependencies

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

Requirements

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

Project Setup

Recommended: scaffold your project with uv or pixi.

# uv
uv init my-revit-tests
cd my-revit-tests
uv add revitdevtool_pytest

# pixi
pixi init my-revit-tests
cd my-revit-tests
pixi add revitdevtool_pytest

Both tools automatically manage virtual environments, lock files, and pyproject.toml — no separate pip setup needed.

Configuration

Add plugin settings to [tool.pytest.ini_options] in your pyproject.toml:

[tool.pytest.ini_options]
testpaths = ["tests"]
revit_version = "2025"
revit_launch = true
revit_launch_timeout = "180"

With uv or pixi, run tests via uv run pytest or pixi run pytest.

All options are settable via [tool.pytest.ini_options] or standard INI files (pytest.ini, tox.ini, setup.cfg):

Option Type Default Description
revit_version string Revit version year (e.g. "2025"). Required when revit_launch = true.
revit_launch bool false Auto-launch Revit if no running instance found.
revit_timeout string "60" Per-test execution timeout in seconds.
revit_launch_timeout string "120" Seconds to wait for Revit to start.
revit_pipe string Explicit pipe name (bypasses auto-discovery).

CLI flags override INI settings for one-off runs:

pytest --revit-launch --revit-version=2025 -v

Usage

def test_revit_version():
    app = __revit__.Application
    assert "2025" in app.VersionName
# With pyproject.toml configured, just run:
pytest

# Or override for a single run:
pytest --revit-version=2026 -v

How It Works

  1. pytest discovers tests locally as usual
  2. Plugin intercepts execution via pytest_runtestloop
  3. Test source 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": [
        "tests"
    ]
}

CLI args can go in pytestArgs if not configured in pyproject.toml:

{
    "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.1.0.tar.gz (62.0 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.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: revitdevtool_pytest-0.1.0.tar.gz
  • Upload date:
  • Size: 62.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 001ab2fc4d9d7150bb0915783fae34fab26f6054d5859cc071c9c858f7ddd10b
MD5 7f96276b6aaa7233a42f6961c3ea7a3e
BLAKE2b-256 a2dfd0b313422aa8e76e065df54b7f19be0d1dced02597236305e6a2b95bff9e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for revitdevtool_pytest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc880f51796c656e2ed25a50e1d32c3af4be9b4224e28945fac948ff546a168a
MD5 027ec668efea1ebf9a1202d5a5446587
BLAKE2b-256 d68ceeb3639f80805b773795532338e8c6eebf4dbedcb2588e1bf879c488ccf4

See more details on using hashes here.

Provenance

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