You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marvin.apache.org by we...@apache.org on 2021/10/23 13:13:18 UTC

[incubator-marvin] 03/04: Fix CLI tests tensorflow serializer version on tox

This is an automated email from the ASF dual-hosted git repository.

weichen pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-marvin.git

commit 5b89321476ed205010296a3de0e0268759b458a9
Author: cardosolucas <ca...@gmail.com>
AuthorDate: Thu Oct 21 21:46:45 2021 -0300

    Fix CLI tests tensorflow serializer version on tox
---
 .travis.yml                              |  5 ++---
 marvin-cli/tests/management/test_edit.py |  7 -------
 marvin-cli/tests/utils/test_benchmark.py |  2 +-
 marvin-cli/tests/utils/test_docker.py    | 13 +++++++------
 marvin-cli/tests/utils/test_git.py       |  4 ++--
 marvin-cli/tests/utils/test_misc.py      | 10 +++++-----
 python-daemon/tox.ini                    |  1 +
 7 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9ead5a1..525b246 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,15 +50,14 @@ matrix:
         - export MARVIN_DATA_PATH=./marvin_data
         - export SPARK_HOME=../spark-2.1.1-bin-hadoop2.6
         - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libsasl2-dev python-pip graphviz -y    ; fi
-        - travis_retry sudo pip install --upgrade pip
-        - travis_retry sudo pip install virtualenvwrapper --ignore-installed six
+        - travis_retry pip install --upgrade pip
+        - travis_retry pip install virtualenvwrapper --ignore-installed six
         - source virtualenvwrapper.sh
       install:
         - travis_retry pip install codecov
         - travis_retry pip install unidecode
         - travis_retry pip install tox
         - make install
-        - travis_retry pip install 'h5py==2.10.0' --force-reinstall
       script:
         - tox
         - codecov
diff --git a/marvin-cli/tests/management/test_edit.py b/marvin-cli/tests/management/test_edit.py
index 00eba18..3b1b630 100755
--- a/marvin-cli/tests/management/test_edit.py
+++ b/marvin-cli/tests/management/test_edit.py
@@ -23,7 +23,6 @@ except ImportError:
     import unittest.mock as mock
 
 from marvin_cli.management.edit import config
-from marvin_cli.management.edit import metadata
 mocked_obj = {
     'editor': 'mocked'
 }
@@ -34,11 +33,5 @@ def test_config():
         runner = click.testing.CliRunner()
         runner.invoke(config)
 
-def test_metadata():
-    ctx = click.Context(click.Command('edit-metadata'), obj=mocked_obj)
-    with ctx:
-        runner = click.testing.CliRunner()
-        runner.invoke(metadata)
-
 
 
diff --git a/marvin-cli/tests/utils/test_benchmark.py b/marvin-cli/tests/utils/test_benchmark.py
index 2162779..d011f72 100755
--- a/marvin-cli/tests/utils/test_benchmark.py
+++ b/marvin-cli/tests/utils/test_benchmark.py
@@ -68,7 +68,7 @@ mocked_data = {
 
 def test_create_or_get_benchmark_folder():
     path = create_or_get_benchmark_folder()
-    assert path == os.path.join(os.getcwd(), 'benchmarks')
+    assert path == os.path.join(os.environ['MARVIN_HOME'], 'benchmarks')
 
 def test_create_or_return_poi():
     timestamp = 'mocked_timestamp'
diff --git a/marvin-cli/tests/utils/test_docker.py b/marvin-cli/tests/utils/test_docker.py
index 5360883..25167d4 100755
--- a/marvin-cli/tests/utils/test_docker.py
+++ b/marvin-cli/tests/utils/test_docker.py
@@ -47,21 +47,22 @@ def test_search_docker_container():
 @mock.patch('marvin_cli.utils.docker._search_docker_container')
 def test_search_engine_container(search_mocked):
     search_engine_container('marvin_mocked')
-    search_mocked.assert_called_with('marvin-cont-mocked')
+    search_mocked.assert_called_with('marvin-cont-marvin_mocked')
 
 @mock.patch('marvin_cli.utils.docker._search_docker_image')
 def test_search_engine_images(search_mocked):
     search_engine_images('marvin_mocked')
-    search_mocked.assert_called_with('marvin-mocked')
+    search_mocked.assert_called_with('marvin-marvin_mocked')
 
 @mock.patch('marvin_cli.utils.docker._get_client')
 @mock.patch('marvin_cli.utils.docker.generate_engine_package')
 def test_create_engine_image(generate_mocked, client_mocked):
-    create_engine_image('marvin_mocked')
+    mocked_engine_path = 'mocked/path/'
+    create_engine_image('marvin_mocked', mocked_engine_path)
     client_mocked.assert_called()
-    generate_mocked.assert_called_with('marvin_mocked')
+    generate_mocked.assert_called_with('marvin_marvin_mocked', mocked_engine_path)
 
 @mock.patch('marvin_cli.utils.docker._get_client')
 def test_create_daemon_container(client_mocked):
-    create_daemon_container('marvin_mocked', 'mocked')
-    client_mocked.assert_called()
\ No newline at end of file
+    create_daemon_container('marvin_mocked')
+    client_mocked.assert_called()
diff --git a/marvin-cli/tests/utils/test_git.py b/marvin-cli/tests/utils/test_git.py
index a20ea5a..552f6d2 100755
--- a/marvin-cli/tests/utils/test_git.py
+++ b/marvin-cli/tests/utils/test_git.py
@@ -34,5 +34,5 @@ def test_git_init(chdir_mocked, system_mocked):
 
 @mock.patch('marvin_cli.utils.git.os.system')
 def test_bumpversion(system_mocked):
-    bump_version('patch', True, True)
-    system_mocked.assert_called_with('bump2version patch --verbose --dry-run')
\ No newline at end of file
+    bump_version('patch', 'mocked', True, True)
+    system_mocked.assert_called_with('bump2version mocked patch --verbose --dry-run')
diff --git a/marvin-cli/tests/utils/test_misc.py b/marvin-cli/tests/utils/test_misc.py
index b52f188..2a629ef 100755
--- a/marvin-cli/tests/utils/test_misc.py
+++ b/marvin-cli/tests/utils/test_misc.py
@@ -44,8 +44,8 @@ def test_package_to_name():
 
 @mock.patch('marvin_cli.utils.misc.os.path.join')
 def test_get_version(join_mocked):
-    get_version(mocked_package)
-    join_mocked.assert_called_with(os.getcwd(), mocked_package, 'VERSION')
+    get_version(mocked_package, mocked_path)
+    join_mocked.assert_called_with(mocked_path, mocked_package, 'VERSION')
 
 @mock.patch('marvin_cli.utils.misc.tarfile.open')
 def test_package_folder(open_mocked):
@@ -59,10 +59,10 @@ def test_extract_folder(open_mocked):
 
 @mock.patch('marvin_cli.utils.misc.subprocess.Popen')
 def test_call_logs(popen_mocked):
-    call_logs(mocked_package, True, 0)
-    popen_mocked.assert_called_with(['docker', 'logs', '--follow', 'marvin-cont-mocked'], stdout=-1)
+    call_logs(mocked_package)
+    popen_mocked.assert_called_with(['docker', 'logs', '--follow', 'marvin-cont-' + mocked_package], stdout=-1)
 
 @mock.patch('marvin_cli.utils.misc.wget.download')
 def test_get_executor_path_or_download(wget_mocked):
     get_executor_path_or_download(mocked_url)
-    wget_mocked.assert_called_with(mocked_url, out=os.path.join(os.environ['MARVIN_DATA_PATH'], 'marvin.jar'))
\ No newline at end of file
+    wget_mocked.assert_called_with(mocked_url, out=os.path.join(os.environ['MARVIN_DATA_PATH'], 'marvin.jar'))
diff --git a/python-daemon/tox.ini b/python-daemon/tox.ini
index 8e918b7..059e2f5 100644
--- a/python-daemon/tox.ini
+++ b/python-daemon/tox.ini
@@ -6,5 +6,6 @@ deps=pytest
      pytest-cov
      mock
      tensorflow
+     h5py==2.10.0
 commands=py.test --cov={envsitepackagesdir}/marvin_python_daemon --cov-report html --cov-report xml {posargs}
 passenv=SPARK_HOME MARVIN_HOME MARVIN_DATA_PATH MARVIN_LOG