From 42114417269a546a663f1dc624eb1e1e6aef7192 Mon Sep 17 00:00:00 2001 From: Cade Daniel Date: Tue, 27 Jun 2023 16:21:45 -0700 Subject: [PATCH] Lint Signed-off-by: Cade Daniel --- ci/env/check_minimal_install.py | 14 +++++++++++--- python/ray/tests/test_minimal_install.py | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ci/env/check_minimal_install.py b/ci/env/check_minimal_install.py index 4db1c7b573e4..b4e8761e85be 100644 --- a/ci/env/check_minimal_install.py +++ b/ci/env/check_minimal_install.py @@ -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) diff --git a/python/ray/tests/test_minimal_install.py b/python/ray/tests/test_minimal_install.py index 5e2faed6d267..9fa954fbb042 100644 --- a/python/ray/tests/test_minimal_install.py +++ b/python/ray/tests/test_minimal_install.py @@ -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"):