Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
Signed-off-by: Cade Daniel <cade@anyscale.com>
  • Loading branch information
cadedaniel committed Jun 27, 2023
1 parent 1f5867e commit 4211441
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
14 changes: 11 additions & 3 deletions ci/env/check_minimal_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,25 @@ def assert_packages_not_installed(blacklist: List[str]):
f"current Python environment: {blacklist}"
)


def assert_python_version(expected_python_version: str) -> None:
actual_major, actual_minor = sys.version_info[:2]
actual_version = f'{actual_major}.{actual_minor}'
actual_version = f"{actual_major}.{actual_minor}"
expected_version = expected_python_version.strip()
assert expected_version == actual_version, f"Expected Python version {expected_version=}, {actual_version=}"
assert (
expected_version == actual_version
), f"Expected Python version {expected_version=}, {actual_version=}"


if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument("--expected-python-version", type=str, required=True, help="Expected Python version in MAJOR.MINOR format, e.g. 3.11")
parser.add_argument(
"--expected-python-version",
type=str,
required=True,
help="Expected Python version in MAJOR.MINOR format, e.g. 3.11",
)
args = parser.parse_args()

assert_packages_not_installed(DEFAULT_BLACKLIST)
Expand Down
17 changes: 13 additions & 4 deletions python/ray/tests/test_minimal_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,26 @@
import os
import sys

@pytest.mark.skipif(os.environ.get("RAY_MINIMAL", "0") != "1", reason="Skip unless running in a minimal install.")

@pytest.mark.skipif(
os.environ.get("RAY_MINIMAL", "0") != "1",
reason="Skip unless running in a minimal install.",
)
def test_correct_python_version():
"""
Validate that Bazel uses the correct Python version in our minimal tests.
"""
expected_python_version = os.environ.get("EXPECTED_PYTHON_VERSION", '').strip()
assert expected_python_version, f"EXPECTED_PYTHON_VERSION is {expected_python_version=}"
expected_python_version = os.environ.get("EXPECTED_PYTHON_VERSION", "").strip()
assert (
expected_python_version
), f"EXPECTED_PYTHON_VERSION is {expected_python_version=}"

actual_major, actual_minor = sys.version_info[:2]
actual_version = f"{actual_major}.{actual_minor}"
assert actual_version == expected_python_version, f"{expected_python_version=} {actual_version=}"
assert (
actual_version == expected_python_version
), f"{expected_python_version=} {actual_version=}"


if __name__ == "__main__":
if os.environ.get("PARALLEL_CI"):
Expand Down

0 comments on commit 4211441

Please sign in to comment.