From 7ba9240c94d1e730722492ee04aa1be2251062d8 Mon Sep 17 00:00:00 2001 From: John Platt Date: Thu, 21 Feb 2019 12:24:20 -0500 Subject: [PATCH] moved python script to testing folder --- pkg/suggestion/.coveragerc | 6 ------ pkg/suggestion/python_tests.sh | 2 -- pkg/suggestion/tests/study_config.yaml | 2 +- pkg/suggestion/tests/test_algorithm_manager.py | 8 ++++++-- test/scripts/python_tests.sh | 5 +++++ 5 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 pkg/suggestion/.coveragerc delete mode 100755 pkg/suggestion/python_tests.sh create mode 100755 test/scripts/python_tests.sh diff --git a/pkg/suggestion/.coveragerc b/pkg/suggestion/.coveragerc deleted file mode 100644 index 45fbb89356b..00000000000 --- a/pkg/suggestion/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -branch = True -source = bayesianoptimization/src - -[report] -show_missing = True diff --git a/pkg/suggestion/python_tests.sh b/pkg/suggestion/python_tests.sh deleted file mode 100755 index ef8af4755d2..00000000000 --- a/pkg/suggestion/python_tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -pylint bayesianoptimization/src --disable=fixme --exit-zero --reports=y -pytest tests --verbose --cov=bayesianoptimization/src --cov-report term-missing diff --git a/pkg/suggestion/tests/study_config.yaml b/pkg/suggestion/tests/study_config.yaml index 7917899df03..6644951d50b 100644 --- a/pkg/suggestion/tests/study_config.yaml +++ b/pkg/suggestion/tests/study_config.yaml @@ -18,7 +18,7 @@ parameter_configs: - 2 - 3 - 5 - - parameter_type: 4 # Code for DISCRETE + - parameter_type: 4 # Code for CATEGORICAL name: "fake_categorical" feasible: list: diff --git a/pkg/suggestion/tests/test_algorithm_manager.py b/pkg/suggestion/tests/test_algorithm_manager.py index c7ea6c3df94..b5ba3bc190c 100644 --- a/pkg/suggestion/tests/test_algorithm_manager.py +++ b/pkg/suggestion/tests/test_algorithm_manager.py @@ -1,3 +1,5 @@ +import os + import yaml import pytest import numpy as np @@ -7,17 +9,19 @@ from ..bayesianoptimization.src.algorithm_manager import AlgorithmManager +TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + @pytest.fixture def study_config(): - with open("tests/study_config.yaml", "r", encoding="utf-8") as f: + with open(os.path.join(TEST_DIR, "study_config.yaml"), "r") as f: contents = yaml.safe_load(f) return Box(contents) @pytest.fixture def observations(): - with open("tests/parameter_values.yaml", "r", encoding="utf-8") as f: + with open(os.path.join(TEST_DIR, "parameter_values.yaml"), "r") as f: contents = yaml.safe_load(f) return Box(contents) diff --git a/test/scripts/python_tests.sh b/test/scripts/python_tests.sh new file mode 100755 index 00000000000..6f90afc1a4d --- /dev/null +++ b/test/scripts/python_tests.sh @@ -0,0 +1,5 @@ +pip install -r cmd/suggestion/bayesianoptimization/requirements.txt +pip install -r pkg/suggestion/test_requirements.txt +python setup.py develop +pylint pkg/suggestion/bayesianoptimization/src --disable=fixme --exit-zero --reports=y +pytest pkg/suggestion/tests --verbose --cov=pkg/suggestion/bayesianoptimization/src --cov-report term-missing