pytest plugin for testing Revit API code via RevitDevTool Named Pipe bridge
Project description
RevitDevTool.PyTest
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
uvorpixi, run tests viauv run pytestorpixi 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
- pytest discovers tests locally as usual
- Plugin intercepts execution via
pytest_runtestloop - Test source is serialized and sent over Named Pipe to Revit
- RevitDevTool add-in executes the test inside Revit's Python (pythonnet) environment
- 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
001ab2fc4d9d7150bb0915783fae34fab26f6054d5859cc071c9c858f7ddd10b
|
|
| MD5 |
7f96276b6aaa7233a42f6961c3ea7a3e
|
|
| BLAKE2b-256 |
a2dfd0b313422aa8e76e065df54b7f19be0d1dced02597236305e6a2b95bff9e
|
Provenance
The following attestation bundles were made for revitdevtool_pytest-0.1.0.tar.gz:
Publisher:
publish.yml on trgiangv/RevitDevTool.PyTest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
revitdevtool_pytest-0.1.0.tar.gz -
Subject digest:
001ab2fc4d9d7150bb0915783fae34fab26f6054d5859cc071c9c858f7ddd10b - Sigstore transparency entry: 1435916746
- Sigstore integration time:
-
Permalink:
trgiangv/RevitDevTool.PyTest@cf21f468d41675c677787b55be8f1a5bb43a66ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/trgiangv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf21f468d41675c677787b55be8f1a5bb43a66ec -
Trigger Event:
release
-
Statement type:
File details
Details for the file revitdevtool_pytest-0.1.0-py3-none-any.whl.
File metadata
- Download URL: revitdevtool_pytest-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc880f51796c656e2ed25a50e1d32c3af4be9b4224e28945fac948ff546a168a
|
|
| MD5 |
027ec668efea1ebf9a1202d5a5446587
|
|
| BLAKE2b-256 |
d68ceeb3639f80805b773795532338e8c6eebf4dbedcb2588e1bf879c488ccf4
|
Provenance
The following attestation bundles were made for revitdevtool_pytest-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on trgiangv/RevitDevTool.PyTest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
revitdevtool_pytest-0.1.0-py3-none-any.whl -
Subject digest:
bc880f51796c656e2ed25a50e1d32c3af4be9b4224e28945fac948ff546a168a - Sigstore transparency entry: 1435916755
- Sigstore integration time:
-
Permalink:
trgiangv/RevitDevTool.PyTest@cf21f468d41675c677787b55be8f1a5bb43a66ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/trgiangv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf21f468d41675c677787b55be8f1a5bb43a66ec -
Trigger Event:
release
-
Statement type: