Skip to content

Commit

Permalink
fix validation unit test
Browse files Browse the repository at this point in the history
Signed-off-by: hjiang <[email protected]>
  • Loading branch information
dentiny committed Dec 10, 2024
1 parent 6d44972 commit 6f4a7d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion python/ray/_private/runtime_env/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ async def _install_uv_packages(
"uv",
"pip",
"install",
"" if self._uv_config.get("enable_uv_cache", False) else "--no-cache",
"-r",
requirements_file,
]
if not self._uv_config.get("enable_uv_cache", False):
uv_install_cmd += ["--no-cache"]

logger.info("Installing python requirements to %s", virtualenv_path)
await check_output_cmd(uv_install_cmd, logger=logger, cwd=cwd, env=pip_env)

Expand Down
13 changes: 11 additions & 2 deletions python/ray/tests/unit/test_runtime_env_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ class TestVaidationUv:
def test_parse_and_validate_uv(self, test_directory):
# Valid case w/o duplication.
result = validation.parse_and_validate_uv({"packages": ["tensorflow"]})
assert result == {"packages": ["tensorflow"], "uv_check": False}
assert result == {
"enable_uv_cache": False,
"packages": ["tensorflow"],
"uv_check": False,
}

# Valid case w/ duplication.
result = validation.parse_and_validate_uv(
{"packages": ["tensorflow", "tensorflow"]}
)
assert result == {"packages": ["tensorflow"], "uv_check": False}
assert result == {
"enable_uv_cache": False,
"packages": ["tensorflow"],
"uv_check": False,
}

# Valid case, use `list` to represent necessary packages.
result = validation.parse_and_validate_uv(
Expand All @@ -58,6 +66,7 @@ def test_parse_and_validate_uv(self, test_directory):
{"packages": ["tensorflow"], "uv_version": "==0.4.30"}
)
assert result == {
"enable_uv_cache": False,
"packages": ["tensorflow"],
"uv_version": "==0.4.30",
"uv_check": False,
Expand Down

0 comments on commit 6f4a7d6

Please sign in to comment.