Skip to content

Commit

Permalink
Add travis CI for new unit test. (kubeflow#1960)
Browse files Browse the repository at this point in the history
* Relocate unit test for sample test infra.

* Relocate utils tests and add travis ci check.

* Revert accidental change.

* Lint

* Fix travis build

* Move dependencies to install section.

* Fix travis build

* Fix travis build

* Fix travis build
  • Loading branch information
Jiaxiao Zheng authored and ajchili committed Aug 28, 2019
1 parent c32d1b3 commit 3305709
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ matrix:
- language: python
python: "3.5"
env: TOXENV=py35
script: &1
install: &0
# Additional dependencies
- pip3 install coverage coveralls jsonschema==3.0.1
- pip3 install coverage coveralls jsonschema==3.0.1
# Sample test infra dependencies
- pip3 install minio
- pip3 install junit_xml
# Visualization test dependencies
- cd $TRAVIS_BUILD_DIR/backend/src/apiserver/visualization
- pip3 install -r requirements-test.txt
script: &1

# DSL tests
- cd $TRAVIS_BUILD_DIR/sdk/python
- python3 setup.py develop
Expand All @@ -78,8 +86,6 @@ matrix:

# Visualization test
- cd $TRAVIS_BUILD_DIR/backend/src/apiserver/visualization
# Visualization test dependencies
- pip3 install -r requirements-test.txt
- python3 test_exporter.py
- python3 test_server.py

Expand All @@ -89,13 +95,19 @@ matrix:
# Component SDK tests
- cd $TRAVIS_BUILD_DIR/components/gcp/container/component_sdk/python
- ./run_test.sh

# Sample test unittests.
- cd $TRAVIS_BUILD_DIR/test/sample-test/unittests
- python3 -m unittest utils_tests.py
- language: python
python: "3.6"
env: TOXENV=py36
install: *0
script: *1
- language: python
python: "3.7"
env: TOXENV=py37
install: *0
script: *1
- name: "Lint Python code with flake8"
language: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@

import os
import shutil
import sys
import unittest
import utils
import yaml


# Need to adjust sys path to find utils.py
_PACKAGE_PARENT = '..'
_SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(_SCRIPT_DIR, _PACKAGE_PARENT)))

import utils


_DATAPATH = 'testdata/'
_WORK_DIR = 'workdir/'


class TestUtils(unittest.TestCase):
"""Unit tests for utility functions defined in test/sample-test/utils.py"""
def setUp(self) -> None:
Expand Down

0 comments on commit 3305709

Please sign in to comment.