diff --git a/.travis.yml b/.travis.yml index a5a850faf62..dd56ebc1d95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 @@ -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 diff --git a/test/sample-test/testdata/test_file_injection_input.yaml b/test/sample-test/unittests/testdata/test_file_injection_input.yaml similarity index 100% rename from test/sample-test/testdata/test_file_injection_input.yaml rename to test/sample-test/unittests/testdata/test_file_injection_input.yaml diff --git a/test/sample-test/testdata/test_file_injection_output.yaml b/test/sample-test/unittests/testdata/test_file_injection_output.yaml similarity index 100% rename from test/sample-test/testdata/test_file_injection_output.yaml rename to test/sample-test/unittests/testdata/test_file_injection_output.yaml diff --git a/test/sample-test/utils_tests.py b/test/sample-test/unittests/utils_tests.py similarity index 89% rename from test/sample-test/utils_tests.py rename to test/sample-test/unittests/utils_tests.py index 30c73a1d1ea..8de1f218a56 100644 --- a/test/sample-test/utils_tests.py +++ b/test/sample-test/unittests/utils_tests.py @@ -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: