fix tests, maybe

This commit is contained in:
Lendemor 2025-01-24 23:01:07 +01:00
parent 6b129c5641
commit e97c198057
2 changed files with 7 additions and 9 deletions

View File

@ -1054,9 +1054,7 @@ def install_bun():
)
# Skip if bun is already installed.
if Path(get_config().bun_path).exists() and get_bun_version() == version.parse(
constants.Bun.VERSION
):
if get_bun_version() == version.parse(constants.Bun.VERSION):
console.debug("Skipping bun installation as it is already installed.")
return

View File

@ -122,13 +122,13 @@ def test_validate_invalid_bun_path(mocker):
Args:
mocker: Pytest mocker object.
"""
mock = mocker.Mock()
mocker.patch.object(mock, "bun_path", return_value="/mock/path")
mocker.patch("reflex.utils.prerequisites.get_config", mock)
mock_path = mocker.Mock()
mocker.patch("reflex.utils.path_ops.get_bun_path", return_value=mock_path)
mocker.patch("reflex.utils.prerequisites.get_bun_version", return_value=None)
with pytest.raises(typer.Exit):
prerequisites.validate_bun()
mock_path.samefile.assert_called_once()
def test_validate_bun_path_incompatible_version(mocker):
@ -137,9 +137,9 @@ def test_validate_bun_path_incompatible_version(mocker):
Args:
mocker: Pytest mocker object.
"""
mock = mocker.Mock()
mocker.patch.object(mock, "bun_path", return_value="/mock/path")
mocker.patch("reflex.utils.prerequisites.get_config", mock)
mocker.patch(
"reflex.utils.path_ops.get_bun_path", return_value=constants.Bun.DEFAULT_PATH
)
mocker.patch(
"reflex.utils.prerequisites.get_bun_version",
return_value=version.parse("0.6.5"),