mock current_tag prop instead of json.load

This commit is contained in:
foamyguy 2024-04-08 11:42:41 -05:00
parent 1c1307b070
commit d3515e9eed
2 changed files with 4 additions and 11 deletions

View file

@ -108,17 +108,10 @@ def ensure_latest_bundle(bundle):
for platform in PLATFORMS:
# missing directories (new platform added on an existing install
# or side effect of pytest or network errors)
# print(
# f"checking dir: {bundle.lib_dir(platform)} = "
# f"{os.path.isdir(bundle.lib_dir(platform))}",
# file=sys.stderr,
# )
# pylint: disable=unreachable
raise RuntimeError(
print(
f"checking dir: {bundle.lib_dir(platform)} = "
f"{os.path.isdir(bundle.lib_dir(platform))}"
)
do_update = do_update or not os.path.isdir(bundle.lib_dir(platform))
else:
do_update = True

View file

@ -1001,11 +1001,11 @@ def test_ensure_latest_bundle_no_update():
) as mock_gb, mock.patch(
"circup.command_utils.os.path.isfile", return_value=True
), mock.patch(
"circup.shared.json"
) as mock_json, mock.patch(
"circup.bundle.Bundle.current_tag", "12345"
), mock.patch(
"circup.command_utils.logger"
) as mock_logger:
mock_json.load.return_value = {TEST_BUNDLE_NAME: "12345"}
bundle = circup.Bundle(TEST_BUNDLE_NAME)
ensure_latest_bundle(bundle)
assert mock_gb.call_count == 0