From ff16e841b8a0e65bde45a194bc5da7d79e961098 Mon Sep 17 00:00:00 2001 From: Yuki Iwai Date: Mon, 11 Mar 2024 01:05:28 +0900 Subject: [PATCH] Prepare dedicated pytest for skopt Signed-off-by: Yuki Iwai --- .github/workflows/test-python.yaml | 20 ++++++++++++++++++++ Makefile | 10 ++++++++++ cmd/suggestion/skopt/v1beta1/Dockerfile | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 7740cae281b..1ae63b677bd 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -25,3 +25,23 @@ jobs: - name: Run Python test run: make pytest + + # The skopt service doesn't work appropriately with Python 3.11. + # So, we need to run the test with Python 3.9. + # TODO (tenzen-y): Once we stop to support skopt, we can remove this test. + # REF: https://github.com/kubeflow/katib/issues/2280 + test-skopt: + name: Test Skopt + runs-on: ubuntu-22.04 + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Run Python test + run: make pytest-skopt diff --git a/Makefile b/Makefile index 8cf6d414823..fb093601e84 100755 --- a/Makefile +++ b/Makefile @@ -179,3 +179,13 @@ pytest: prepare-pytest prepare-pytest-testdata PYTHONPATH=$(PYTHONPATH) pytest ./test/unit/v1beta1/suggestion PYTHONPATH=$(PYTHONPATH) pytest ./test/unit/v1beta1/earlystopping PYTHONPATH=$(PYTHONPATH) pytest ./test/unit/v1beta1/metricscollector + +# The skopt service doesn't work appropriately with Python 3.11. +# So, we need to run the test with Python 3.9. +# TODO (tenzen-y): Once we stop to support skopt, we can remove this test. +# REF: https://github.com/kubeflow/katib/issues/2280 +pytest-skopt: + pip install six + pip install --prefer-binary -r test/unit/v1beta1/requirements.txt + pip install --prefer-binary -r cmd/suggestion/skopt/v1beta1/requirements.txt + PYTHONPATH=$(PYTHONPATH) pytest ./test/unit/v1beta1/suggestion/test_skopt_service.py diff --git a/cmd/suggestion/skopt/v1beta1/Dockerfile b/cmd/suggestion/skopt/v1beta1/Dockerfile index 0b2ff760eca..2105102cae9 100644 --- a/cmd/suggestion/skopt/v1beta1/Dockerfile +++ b/cmd/suggestion/skopt/v1beta1/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib