Skip to content

Commit

Permalink
Fix test_environment.py. (#5088)
Browse files Browse the repository at this point in the history
* run black

Signed-off-by: harupy <hkawamura0130@gmail.com>

* fix comment

Signed-off-by: harupy <hkawamura0130@gmail.com>
  • Loading branch information
harupy committed Nov 19, 2021
1 parent 0fa849a commit 9faf3b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mlflow/utils/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ def _is_mlflow_requirement(requirement_string):
except InvalidRequirement:
# A local file path or URL falls into this branch.

# `Requirement` throws an `InvalidRequirement` exception if `requirement_string` contains per-requirement options (ex: package hashes)
# `Requirement` throws an `InvalidRequirement` exception if `requirement_string` contains
# per-requirement options (ex: package hashes)
# GitHub issue: https://github.com/pypa/packaging/issues/488
# Per-requirement-option spec: https://pip.pypa.io/en/stable/reference/requirements-file-format/#per-requirement-options
requirement_specifier = _get_pip_requirement_specifier(requirement_string)
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def test_process_pip_requirements(tmpdir):
hash1 = "sha256:963c22532e82a93450674ab97d62f9e528ed0906b580fadb7c003e696197557c"
hash2 = "sha256:b15ff0c7e5e64f864a0b40c99b9a582227315eca2065d9f831db9aeb8f24637b"
conda_env, reqs, cons = _process_pip_requirements(
["a"], pip_requirements=[f"mlflow==1.20.2 --hash={hash1} --hash={hash2}"],
["a"],
pip_requirements=[f"mlflow==1.20.2 --hash={hash1} --hash={hash2}"],
)
assert _get_pip_deps(conda_env) == [f"mlflow==1.20.2 --hash={hash1} --hash={hash2}"]
assert reqs == [f"mlflow==1.20.2 --hash={hash1} --hash={hash2}"]
Expand Down

0 comments on commit 9faf3b0

Please sign in to comment.