Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Python Test

on:
- push
- pull_request

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install Packages
run: |
pip install grpcio-testing==1.40.0
pip install pytest==5.1.2
Comment on lines +23 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about make a requirements.txt including this packages at the source root directory ?


pip install -r cmd/suggestion/chocolate/v1beta1/requirements.txt
pip install -r cmd/suggestion/hyperopt/v1beta1/requirements.txt
pip install -r cmd/suggestion/skopt/v1beta1/requirements.txt
pip install -r cmd/suggestion/optuna/v1beta1/requirements.txt
pip install -r cmd/suggestion/nas/enas/v1beta1/requirements.txt
pip install -r cmd/suggestion/hyperband/v1beta1/requirements.txt
pip install -r cmd/suggestion/nas/darts/v1beta1/requirements.txt

pip install -r cmd/earlystopping/medianstop/v1beta1/requirements.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, maybe in the future we can introduce the python site-packages cache to accelerate the building process.


- name: Run Python test
run: |
export PYTHONPATH=$(pwd):$(pwd)/pkg/apis/manager/v1beta1/python:$(pwd)/pkg/apis/manager/health/python
echo $PYTHONPATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove this line after debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I will address your comments in the following PR.

pytest ./test/unit/v1beta1/suggestion
pytest ./test/unit/v1beta1/earlystopping
37 changes: 0 additions & 37 deletions test/e2e/v1beta1/scripts/python-tests.sh

This file was deleted.

2 changes: 0 additions & 2 deletions test/suggestion/v1beta1/test_requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import grpc
import grpc_testing
import unittest
from unittest.mock import patch

from pkg.apis.manager.v1beta1.python import api_pb2

Expand All @@ -23,6 +24,11 @@

class TestMedianStop(unittest.TestCase):
def setUp(self):
# Mock load Kubernetes config.
patcher = patch('pkg.earlystopping.v1beta1.medianstop.service.config.load_kube_config')
self.mock_sum = patcher.start()
self.addCleanup(patcher.stop)

servicers = {
api_pb2.DESCRIPTOR.services_by_name['EarlyStopping']: MedianStopService(
)
Expand Down Expand Up @@ -60,7 +66,7 @@ def test_get_earlystopping_rules(self):
invocation_metadata={},
request=request, timeout=1)

response, metadata, code, details = get_earlystopping_rules.termination()
_, _, code, _ = get_earlystopping_rules.termination()

self.assertEqual(code, grpc.StatusCode.OK)

Expand Down
File renamed without changes.