diff --git a/.travis.yml b/.travis.yml index ddad2348..d35ce3fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -compiler: +compiler: # - gcc - clang @@ -18,7 +18,7 @@ before_install: - if [ "$CXX" == "clang++" ]; then sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; fi - if [ "$CXX" == "clang++" ]; then sudo add-apt-repository --yes ppa:h-rayflood/llvm; fi - if [ "$CXX" == "clang++" ]; then sudo apt-get -qq update; fi - - if [ "$CXX" == "clang++" ]; then sudo apt-get -qq install libstdc++-4.8-dev clang-3.4; fi + - if [ "$CXX" == "clang++" ]; then sudo apt-get -qq install libstdc++-4.8-dev clang-3.4; fi - if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.4"; fi - if [ "$CXX" == "clang++" ]; then export CC= "clang++-3.4"; fi @@ -36,14 +36,15 @@ install: - export BOOST_ROOT=$(pwd)/boost script: - - mkdir build - - cd build - - cmake .. -DBUILD_PYGMO="ON" -DENABLE_TESTS="ON" -DPYTHON_MODULES_DIR="~/local/python" -DCMAKE_INSTALL_PREFIX="~/local" - - make -j4 - - make test - - make install + - mkdir build + - cd build + - cmake .. -DBUILD_PYGMO="ON" -DENABLE_TESTS="ON" -DPYTHON_MODULES_DIR="~/local/python" -DCMAKE_INSTALL_PREFIX="~/local" + - make -j4 + - make test + - make install + - export PYTHONPATH=~/local/python + - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/local/lib:${PWD%/build}/boost/lib + - python -c "from PyGMO import test; test.run_full_test_suite()" after_success: - - export PYTHONPATH=~/local/python - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/local/lib:~/build/esa/pagmo/boost/lib - - python -c "import PyGMO; print(PyGMO.__version__)" + - python -c "import PyGMO; print(PyGMO.__version__)" diff --git a/PyGMO/test/__init__.py b/PyGMO/test/__init__.py index cafadf7e..6f39b8d9 100644 --- a/PyGMO/test/__init__.py +++ b/PyGMO/test/__init__.py @@ -27,13 +27,20 @@ class _serialization_test(_ut.TestCase): def test_pickle(self): - from PyGMO import archipelago, island_list, problem_list, algorithm_list, problem, algorithm + from PyGMO import archipelago, island_list, problem_list, algorithm_list, problem import pickle from copy import deepcopy # We remove some problems that cannot be constructed without external # txt data files prob_list = deepcopy(problem_list) prob_list.remove(problem.cec2013) + + # Remove trajectory problems if PyKEP is not installed + try: + import PyKEP + except ImportError: + prob_list.remove(problem.py_pl2pl) + print('') for isl in island_list: for prob in prob_list: @@ -114,6 +121,7 @@ def run_island_torture_test_suite(): def run_full_test_suite(): """Run the complete test suite for PyGMO.""" + import sys from PyGMO import test from PyGMO.test._hypervolume_tests import get_hv_suite from PyGMO.test._topology_tests import get_topology_test_suite @@ -125,7 +133,8 @@ def run_full_test_suite(): suite.addTests(get_topology_test_suite()) suite.addTests(get_archipelago_test_suite()) - _ut.TextTestRunner(verbosity=2).run(suite) + successful = _ut.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(0 if successful else 1) def run_hv_test_suite(): diff --git a/PyGMO/test/_archipelago_tests.py b/PyGMO/test/_archipelago_tests.py index c2446b49..faea2e51 100644 --- a/PyGMO/test/_archipelago_tests.py +++ b/PyGMO/test/_archipelago_tests.py @@ -1,6 +1,7 @@ from PyGMO import topology, algorithm, problem, archipelago, distribution_type, migration_direction, island, population, migration import unittest + class ArchipelagoTests(unittest.TestCase): """Test archipelago properties""" @@ -89,7 +90,6 @@ def test_one_way_ring_null_alg(self): top.set_weight(0.0) self.do_test_migr_setup(pop_xs, pop_xs, top, 1) - def test_distribution_type(self): """Testing whether the distribution_type property works""" @@ -103,6 +103,7 @@ def test_distribution_type(self): self.assertEqual(a.distribution_type, dist_type) + def get_archipelago_test_suite(): suite = unittest.TestSuite() suite.addTests(unittest.makeSuite(ArchipelagoTests))