This is an automated email from the ASF dual-hosted git repository. jbonofre pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-liminal.git
commit c1d77f21b750402487063ba32ac4439d5382be52 Author: aviemzur <[email protected]> AuthorDate: Sun Mar 22 10:31:07 2020 +0200 Make paths in tests relative to script location --- .../airflow/build/http/python/test_python_server_image_builder.py | 7 ++++--- tests/runners/airflow/build/python/test_python_image_builder.py | 7 +++++-- tests/runners/airflow/build/test_build_rainbows.py | 5 ++--- tests/runners/airflow/dag/test_rainbow_dags.py | 4 +++- tests/runners/airflow/tasks/test_python.py | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/runners/airflow/build/http/python/test_python_server_image_builder.py b/tests/runners/airflow/build/http/python/test_python_server_image_builder.py index 3423976..63fc8fa 100644 --- a/tests/runners/airflow/build/http/python/test_python_server_image_builder.py +++ b/tests/runners/airflow/build/http/python/test_python_server_image_builder.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - +import os import threading import time import unittest @@ -41,8 +41,9 @@ class TestPythonServer(TestCase): self.docker_client.close() def test_build_python_server(self): + base_path = os.path.join(os.path.dirname(__file__), '../../../rainbow') builder = PythonServerImageBuilder(config=self.config, - base_path='tests/runners/airflow/rainbow', + base_path=base_path, relative_source_path='myserver', tag=self.image_name) @@ -87,7 +88,7 @@ class TestPythonServer(TestCase): 'task': task_id, 'cmd': 'foo bar', 'image': 'rainbow_server_image', - 'source': 'tests/runners/airflow/rainbow/myserver', + 'source': 'baz', 'input_type': 'my_input_type', 'input_path': 'my_input', 'output_path': '/my_output.json', diff --git a/tests/runners/airflow/build/python/test_python_image_builder.py b/tests/runners/airflow/build/python/test_python_image_builder.py index c8328da..7376987 100644 --- a/tests/runners/airflow/build/python/test_python_image_builder.py +++ b/tests/runners/airflow/build/python/test_python_image_builder.py @@ -15,6 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +import os from unittest import TestCase import docker @@ -29,8 +30,10 @@ class TestPythonImageBuilder(TestCase): image_name = config['image'] + base_path = os.path.join(os.path.dirname(__file__), '../../rainbow') + builder = PythonImageBuilder(config=config, - base_path='tests/runners/airflow/rainbow', + base_path=base_path, relative_source_path='helloworld', tag=image_name) @@ -59,7 +62,7 @@ class TestPythonImageBuilder(TestCase): 'task': task_id, 'cmd': 'foo bar', 'image': 'rainbow_image', - 'source': 'tests/runners/airflow/rainbow/helloworld', + 'source': 'baz', 'input_type': 'my_input_type', 'input_path': 'my_input', 'output_path': '/my_output.json' diff --git a/tests/runners/airflow/build/test_build_rainbows.py b/tests/runners/airflow/build/test_build_rainbows.py index 9a4d31c..c5d8ea7 100644 --- a/tests/runners/airflow/build/test_build_rainbows.py +++ b/tests/runners/airflow/build/test_build_rainbows.py @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - +import os import unittest from unittest import TestCase @@ -25,7 +25,6 @@ from rainbow.build import build_rainbows class TestBuildRainbows(TestCase): - __image_names = [ 'my_static_input_task_image', 'my_task_output_input_task_image', @@ -46,7 +45,7 @@ class TestBuildRainbows(TestCase): self.docker_client.images.remove(image=image_name) def test_build_rainbow(self): - build_rainbows.build_rainbows('tests/runners/airflow/rainbow') + build_rainbows.build_rainbows(os.path.join(os.path.dirname(__file__), '../rainbow')) for image in self.__image_names: self.docker_client.images.get(image) diff --git a/tests/runners/airflow/dag/test_rainbow_dags.py b/tests/runners/airflow/dag/test_rainbow_dags.py index 2a65f31..c8f2e38 100644 --- a/tests/runners/airflow/dag/test_rainbow_dags.py +++ b/tests/runners/airflow/dag/test_rainbow_dags.py @@ -1,3 +1,4 @@ +import os from unittest import TestCase from rainbow.runners.airflow.dag import rainbow_dags @@ -6,7 +7,8 @@ import unittest class Test(TestCase): def test_register_dags(self): - dags = rainbow_dags.register_dags('tests/runners/airflow/rainbow') + base_path = os.path.join(os.path.dirname(__file__), '../rainbow') + dags = rainbow_dags.register_dags(base_path) self.assertEqual(len(dags), 1) # TODO: elaborate test pass diff --git a/tests/runners/airflow/tasks/test_python.py b/tests/runners/airflow/tasks/test_python.py index 18e6c1a..ac295eb 100644 --- a/tests/runners/airflow/tasks/test_python.py +++ b/tests/runners/airflow/tasks/test_python.py @@ -50,7 +50,7 @@ class TestPythonTask(TestCase): 'task': task_id, 'cmd': 'foo bar', 'image': 'rainbow_image', - 'source': 'tests/runners/airflow/rainbow/helloworld', + 'source': 'baz', 'input_type': 'my_input_type', 'input_path': 'my_input', 'output_path': '/my_output.json'
