test_revit_module
Hosted unit tests for the pyrevit.revit module surface.
Run from Revit via the DevTools "Revit Module Tests" button (zero-doc context) or the "Run All Tests" aggregator. Document-dependent helpers are exercised with a skip-unless-doc pattern so the suite stays useful on an empty Revit session.
Classes
HostAppTests
Bases: TestCase
HOST_APP application wrapper sanity checks.
Methods:
setUp()
test_host_app_available()
test_version_accessors()
ModuleSurfaceTests
Bases: TestCase
pyrevit.revit submodules expose their documented entry points.
Methods:
test_query_module_entry_points()
Query module exposes core lookup helpers.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_selection_module_entry_points()
Selection module exposes selection helpers.
test_transaction_classes()
Database modules expose Transaction and parameter wrappers.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_events_module_entry_points()
Events module exposes subscribe/unsubscribe helpers.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
UnitConversionTests
Bases: TestCase
Length parsing delegates conversion to Revit's unit API.
Methods:
test_parse_length_matches_unit_utils()
Metric text converts through the Revit millimeter unit identifier.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_parse_length_converts_imperial_components_with_unit_utils()
Feet and inches text converts each component through Revit's unit API.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
DocumentGatedTests
Bases: TestCase
Helpers that need an active project document (skip when absent).
Methods:
setUp()
Skip unless a project document is active.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_get_doc_categories()
Document categories list non-empty on a project document.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_get_all_elements()
Element collection returns elements of the active document.
test_get_name_on_element()
Name lookup reads element names without schema errors.
Source code in pyrevitlib/pyrevit/unittests/test_revit_module.py
test_get_builtincategory_round_trip()
Category resolution maps a category back to its enum value.