test_versionmgr
Hosted unit tests for the pyrevit.versionmgr module.
Run from Revit via the DevTools "Run All Tests" button, which discovers every
test_* module in this package. The tests pin the contract the reported
version depends on: the build the session loaded wins over the clone's version
file, an unresolvable session value degrades to the version file instead of
leaking "Unknown" into the About window, and both feed the same formatter.
Classes
ParseVersionStringTests
Bases: TestCase
Parsing of a build version into its parts.
Methods:
test_build_metadata_is_split_off()
The build number and time stay in the metadata slot.
test_non_zero_patch_is_kept()
A patch release keeps its patch component.
test_channel_suffix_stays_in_metadata()
A channel suffix is part of the reported version, not dropped.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_version_without_metadata()
test_surrounding_whitespace()
The value read back from the env dict may carry whitespace.
test_unusable_values()
Anything that is not a version parses to None.
test_a_version_embedded_in_junk_is_rejected()
A version behind leading text must not be extracted.
The metadata slot stays permissive on purpose - it has to carry both
the yyDDD+HHmm build number and the -wip channel suffix - so
only the anchoring of the version itself is asserted here.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
LoadedBuildVersionTests
Bases: TestCase
The loaded build outranks the clone's version file.
Methods:
setUp()
tearDown()
test_seeded_build_is_reported()
A session-seeded build is what the About window shows.
The sentinel differs from every real version on this machine, so this fails against a formatter that reads the clone's version file instead.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_strict_drops_only_the_build()
Strict reporting drops the build without dropping the release line.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_extended_keeps_the_commit_signature()
Extended reporting still appends the commit the clone sits on.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_unresolvable_session_value_degrades_to_the_version_file()
An unresolvable seed must not reach the user-facing string.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_int_tuple_carries_the_patch()
The integer tuple reports the patch its docstring promises.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_int_tuple_keeps_a_two_digit_patch_decimal()
A two-digit patch is not reinterpreted with a base.
Source code in pyrevitlib/pyrevit/unittests/test_versionmgr.py
test_str_tuple_carries_the_patch()
The string tuple reports the patch as written.