pytest plugin for testing Revit API code via RevitDevTool Named Pipe bridge. Tests run inside a live Revit process — write standard pytest, execute remotely.
pip install revitdevtool_pytestRecommended package name for manifests and package managers such as Pixi:
revitdevtool_pytestpip normalizes package names, so the following forms are equivalent when installing from PyPI:
pip install revitdevtool_pytest
pip install revitdevtool-pytest
pip install RevitDevTool.PyTestThe Python import/module name used by the package is:
import revitdevtool_pytest| Package | Version |
|---|---|
| Python | >= 3.10 |
| pytest | >= 9.0 |
| pywin32 | >= 311 |
- Windows (Named Pipes)
- Revit with RevitDevTool add-in installed
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| 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). |
- pytest discovers tests locally as usual
- The plugin intercepts test execution via
pytest_pyfunc_call - Test source code 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
Add to .vscode/settings.json:
{
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"--revit-launch",
"--revit-version=2025",
"tests"
]
}