From 74f2a139dba03f656b9137b1c0240c9721c8278a Mon Sep 17 00:00:00 2001 From: Alexey Volkov Date: Thu, 8 Nov 2018 20:15:09 -0800 Subject: [PATCH] SDK/Tests - Removed sys.path manipulations. (#151) Also fixed compilation path. --- sdk/python/tests/components/test_components.py | 10 +++------- sdk/python/tests/components/test_python_op.py | 9 +-------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/sdk/python/tests/components/test_components.py b/sdk/python/tests/components/test_components.py index e28082fe678..ed6705a5397 100644 --- a/sdk/python/tests/components/test_components.py +++ b/sdk/python/tests/components/test_components.py @@ -17,19 +17,15 @@ import unittest from pathlib import Path -_this_file = Path(__file__).resolve() -_this_dir = _this_file.parent -_test_data_dir = _this_dir.joinpath('test_data') -_tests_root_dir = _this_dir.parent -_sdk_root_dir = _tests_root_dir.parent - -sys.path.insert(0, _sdk_root_dir) import kfp.components as comp from kfp.components._yaml_utils import load_yaml class LoadComponentTestCase(unittest.TestCase): def test_load_component_from_file(self): + _this_file = Path(__file__).resolve() + _this_dir = _this_file.parent + _test_data_dir = _this_dir.joinpath('test_data') component_path_obj = _test_data_dir.joinpath('python_add.component.yaml') component_text = component_path_obj.read_text() component_dict = load_yaml(component_text) diff --git a/sdk/python/tests/components/test_python_op.py b/sdk/python/tests/components/test_python_op.py index e17b628c9ca..e68ea1fd19d 100644 --- a/sdk/python/tests/components/test_python_op.py +++ b/sdk/python/tests/components/test_python_op.py @@ -22,13 +22,6 @@ import kfp.components as comp from kfp.components._yaml_utils import load_yaml -_this_file = Path(__file__).resolve() -_this_dir = _this_file.parent -_test_data_dir = _this_dir.joinpath('test_data') -_tests_root_dir = _this_dir.parent.parent -_sdk_root_dir = _tests_root_dir.parent - -sys.path.insert(0, _sdk_root_dir) def add_two_numbers(a: float, b: float) -> float: '''Returns sum of two arguments''' @@ -243,7 +236,7 @@ def calc_pipeline( task_3 = subtract_op(task_12.output, task_22.output) #Compiling the pipleine: - pipeline_filename = Path(temp_dir_name).joinpath(calc_pipeline.__name__ + '.pipeline.tar.gz') + pipeline_filename = str(Path(temp_dir_name).joinpath(calc_pipeline.__name__ + '.pipeline.tar.gz')) import kfp.compiler as compiler compiler.Compiler().compile(calc_pipeline, pipeline_filename)