Skip to content


Preflight checks framework.

This framework is designed to automate verification and quality control checks that need to be completed before model is published. The framework works very similarly to unitchecks module.

All preflight checks are subclassed from a base class and are recognized automatically by the preflight module. Each test case, can perform setUp(), startTest(), tearDown(), and doCleanups().


PreflightCheck(extension, check_type, script_path)

Bases: object

Preflight Check.

Source code in pyrevitlib/pyrevit/preflight/
def __init__(self, extension, check_type, script_path):
    self.check_case = check_type = getattr(self.check_case, "name", None) \
        or _get_check_name(script_path)
    self.script_path = script_path

    self.extension = = getattr(self.check_case, "author", None)
    if not = "Unknown"
        extension_pkg = extpkg.get_ext_package_by_name(
        if extension_pkg:

    desc_lines = getattr(self.check_case, "__doc__", "").strip().split('\n')
    if desc_lines:
        self.subtitle = desc_lines[0]
        self.description = '\n'.join([x.strip() for x in desc_lines[1:]])


check_case = check_type instance-attribute
name = getattr(self.check_case, 'name', None) or _get_check_name(script_path) instance-attribute
script_path = script_path instance-attribute
extension = instance-attribute
author = getattr(self.check_case, 'author', None) instance-attribute
subtitle = desc_lines[0] instance-attribute
description = '\n'.join([x.strip() for x in desc_lines[1:]]) instance-attribute


run_preflight_check(check, doc, output)

Run a preflight check.


Name Type Description Default
check PreflightCheck

preflight test case object

doc Document

Revit document

output PyRevitOutputWindow

output window wrapper

Source code in pyrevitlib/pyrevit/preflight/
def run_preflight_check(check, doc, output):
    """Run a preflight check.

        check (PreflightCheck): preflight test case object
        doc (Document): Revit document
        output (pyrevit.output.PyRevitOutputWindow): output window wrapper
    check_case = check.check_case()
    check_case.setUp(doc=doc, output=output)
    check_case.startTest(doc=doc, output=output)
    check_case.tearDown(doc=doc, output=output)
    check_case.doCleanups(doc=doc, output=output)


Find all the preflight checks in installed extensions.

Source code in pyrevitlib/pyrevit/preflight/
def get_all_preflight_checks():
    """Find all the preflight checks in installed extensions."""
    preflight_checks = []
    # get all installed ui extensions
    for ext in extensionmgr.get_installed_ui_extensions():
        # find the checks in the extension
        for check_script in ext.get_checks():
            # load the check source file so all the checks can be extracted
            check_mod = \
                imp.load_source(_get_check_name(check_script), check_script)
            # extract the checks and wrap
            for check_type in _grab_test_types(check_mod):
                    PreflightCheck(ext, check_type, check_script)
    return preflight_checks