コード例 #1
0
 def test_replace_ray_libraries_with_dependencies(self):
     result = parse_and_validate_pip(["pkg1", "ray[serve, tune]", "pkg2"])
     assert "pkg1" in result
     assert "pkg2" in result
     assert "fastapi" in result  # from ray[serve]
     assert "pandas" in result  # from ray[tune]
     assert not any("ray" in specifier for specifier in result)
コード例 #2
0
    def test_validate_pip_valid_file(self, test_directory, absolute_path):
        _, requirements_file, _, _ = test_directory

        if absolute_path:
            requirements_file = requirements_file.resolve()

        result = parse_and_validate_pip(str(requirements_file))
        assert result == PIP_LIST
コード例 #3
0
    def test_validate_pip_valid_file(self, test_directory, absolute_path):
        _, requirements_file, _, _ = test_directory

        if absolute_path:
            requirements_file = requirements_file.resolve()

        result = parse_and_validate_pip(str(requirements_file))
        assert result["packages"] == PIP_LIST
        assert not result["pip_check"]
        assert "pip_version" not in result
コード例 #4
0
 def test_validate_pip_valid_list(self):
     result = parse_and_validate_pip(PIP_LIST)
     assert result == PIP_LIST
コード例 #5
0
 def test_validate_pip_invalid_path(self):
     with pytest.raises(ValueError):
         parse_and_validate_pip("../bad_path.txt")
コード例 #6
0
    def test_validate_pip_invalid_types(self):
        with pytest.raises(TypeError):
            parse_and_validate_pip(1)

        with pytest.raises(TypeError):
            parse_and_validate_pip(True)
コード例 #7
0
 def test_validate_ray(self):
     result = parse_and_validate_pip(["pkg1", "ray", "pkg2"])
     assert result["packages"] == ["pkg1", "ray", "pkg2"]
     assert not result["pip_check"]
     assert "pip_version" not in result
コード例 #8
0
 def test_validate_pip_valid_list(self):
     result = parse_and_validate_pip(PIP_LIST)
     assert result["packages"] == PIP_LIST
     assert not result["pip_check"]
     assert "pip_version" not in result
コード例 #9
0
 def test_validate_ray(self):
     result = parse_and_validate_pip(["pkg1", "ray", "pkg2"])
     assert result == ["pkg1", "ray", "pkg2"]
コード例 #10
0
 def test_remove_ray_env_var(self, monkeypatch):
     monkeypatch.setenv(RAY_RUNTIME_ENV_ALLOW_RAY_IN_PIP, "1")
     result = parse_and_validate_pip(["pkg1", "ray", "pkg2"])
     assert result == ["pkg1", "ray", "pkg2"]