This is an automated email from the ASF dual-hosted git repository. vanzin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-livy.git
The following commit(s) were added to refs/heads/master by this push: new eebf378 [LIVY-570] Replace test archives with auto-generated files. eebf378 is described below commit eebf378343423f7dbcb2b9f079172674315abb3a Author: Marcelo Vanzin <van...@cloudera.com> AuthorDate: Mon Mar 18 16:38:15 2019 -0700 [LIVY-570] Replace test archives with auto-generated files. Author: Marcelo Vanzin <van...@cloudera.com> Closes #159 from vanzin/LIVY-570. --- python-api/pom.xml | 3 +++ python-api/src/test/python/livy-tests/client_test.py | 15 +++++++++++---- .../src/test/python/livy-tests/resources/jar_file.jar | 0 .../src/test/python/livy-tests/resources/zip_file.zip | 0 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/python-api/pom.xml b/python-api/pom.xml index 11df289..ce60fb0 100644 --- a/python-api/pom.xml +++ b/python-api/pom.xml @@ -66,6 +66,9 @@ <argument>setup.py</argument> <argument>test</argument> </arguments> + <environmentVariables> + <TMPDIR>${project.build.directory}/tmp</TMPDIR> + </environmentVariables> </configuration> </execution> <execution> diff --git a/python-api/src/test/python/livy-tests/client_test.py b/python-api/src/test/python/livy-tests/client_test.py index c5c0afa..5e47cb0 100644 --- a/python-api/src/test/python/livy-tests/client_test.py +++ b/python-api/src/test/python/livy-tests/client_test.py @@ -18,7 +18,9 @@ import os import pytest import responses import socket +import tempfile import threading +import zipfile from configparser import NoOptionError from livy.client import HttpClient @@ -130,6 +132,13 @@ def test_connect_to_existing_session(): 'spark.app.name') == 'Test App' +def create_test_archive(ext): + (fd, path) = tempfile.mkstemp(suffix=ext) + os.close(fd) + zipfile.ZipFile(path, mode='w').close() + return path + + @responses.activate def test_submit_job_verify_running_state(): submit_job_future = mock_submit_job_and_poll_result(simple_spark_job, @@ -209,8 +218,7 @@ def test_add_pyfile(): @responses.activate def test_upload_pyfile(): - file_path = os.path.dirname(os.path.abspath(__file__)) + \ - "/resources/zip_file.zip" + file_path = create_test_archive('.zip') pyfile_future = mock_file_apis('upload-pyfile', client_test.upload_pyfile, file_path) pyfile_future.result(15) @@ -219,8 +227,7 @@ def test_upload_pyfile(): @responses.activate def test_add_jar(): - file_uri = "file://" + os.path.dirname(os.path.abspath(__file__)) + \ - "/resources/jar_file.jar" + file_uri = 'file:' + create_test_archive('.jar') add_file_future = mock_file_apis('add-jar', client_test.add_jar, file_uri) add_file_future.result(15) assert add_file_future.done() diff --git a/python-api/src/test/python/livy-tests/resources/jar_file.jar b/python-api/src/test/python/livy-tests/resources/jar_file.jar deleted file mode 100644 index e69de29..0000000 diff --git a/python-api/src/test/python/livy-tests/resources/zip_file.zip b/python-api/src/test/python/livy-tests/resources/zip_file.zip deleted file mode 100644 index e69de29..0000000