diff --git a/scripts/write_install_stamp.py b/scripts/write_install_stamp.py index 105ceaebcb..42f3bf6e63 100644 --- a/scripts/write_install_stamp.py +++ b/scripts/write_install_stamp.py @@ -233,7 +233,7 @@ def build_stamp( try: dev_display_version = dev_version(_REPO_ROOT) - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, ValueError): base_version, distance = "0.0.0", 0 else: base_version, separator, development = dev_display_version.partition("+") diff --git a/tests-js/scripts/desktop-smoke.test.ts b/tests-js/scripts/desktop-smoke.test.ts index 2d34b6aa5c..46a6371c1f 100644 --- a/tests-js/scripts/desktop-smoke.test.ts +++ b/tests-js/scripts/desktop-smoke.test.ts @@ -431,8 +431,11 @@ test('update-window process checks use the isolated launch environment, not the { executable, root, origin: 'source', userData: driver }, )).toThrow('OLD update window did not honor isolated userData') } finally { - if (prior === undefined) delete process.env.HERMES_DESKTOP_USER_DATA_DIR - else process.env.HERMES_DESKTOP_USER_DATA_DIR = prior + if (prior === undefined) { + delete process.env.HERMES_DESKTOP_USER_DATA_DIR + } else { + process.env.HERMES_DESKTOP_USER_DATA_DIR = prior + } } } finally { fs.rmSync(root, { recursive: true, force: true }) } }) diff --git a/tests/scripts/test_install_stamp_distance.py b/tests/scripts/test_install_stamp_distance.py index 7382f3e538..58f8ac731d 100644 --- a/tests/scripts/test_install_stamp_distance.py +++ b/tests/scripts/test_install_stamp_distance.py @@ -53,3 +53,16 @@ def test_distance_is_zero_on_the_release_commit(repo): git(repo, "checkout", "--quiet", "v1.4.0") assert dev_version(repo) == "1.4.0" + + +def test_dev_install_stamp_before_the_first_final_release(repo, monkeypatch): + from scripts import write_install_stamp + + git(repo, "tag", "--delete", "v1.4.0", "v1.4.0-rc") + monkeypatch.setattr(write_install_stamp, "_REPO_ROOT", repo) + + stamp = write_install_stamp.build_stamp(update_mechanism="external") + + assert stamp["baseVersion"] == "0.0.0" + assert stamp["distance"] == 0 + assert stamp["displayVersion"] == "0.0.0"