From d279253994dd5df0eeef7a4c354cd412d6d54d2d Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 29 Aug 2018 08:50:57 -0500 Subject: [PATCH] Handle failure on master --- tests/driver_tests.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/driver_tests.py b/tests/driver_tests.py index c39bfba8..a78bd69e 100644 --- a/tests/driver_tests.py +++ b/tests/driver_tests.py @@ -25,8 +25,10 @@ import subprocess import sys +import warnings from os import remove, path from contextlib import contextmanager +from distutils.version import LooseVersion try: from StringIO import StringIO except ImportError: @@ -34,12 +36,14 @@ import numpy as np import pandas as pd +import sklearn from tpot.driver import positive_integer, float_range, _get_arg_parser, _print_args, _read_data_file, load_scoring_function, tpot_driver from nose.tools import assert_raises, assert_equal, assert_in from unittest import TestCase + @contextmanager def captured_output(): new_out, new_err = StringIO(), StringIO() @@ -169,6 +173,11 @@ def test_driver_4(): def test_driver_5(): """Assert that the tpot_driver() in TPOT driver outputs normal result with exported python file and verbosity = 0.""" + + # Catch FutureWarning https://github.com/scikit-learn/scikit-learn/issues/11785 + handle_warning = (np.__version__ >= LooseVersion("1.15.0") and + sklearn.__version__ <= LooseVersion("0.20.0")) + args_list = [ 'tests/tests.csv', '-is', ',', @@ -183,7 +192,12 @@ def test_driver_5(): ] args = _get_arg_parser().parse_args(args_list) with captured_output() as (out, err): - tpot_driver(args) + with warnings.catch_warnings(): + if handle_warning: + warnings.filterwarnings("ignore", + category=FutureWarning, + module="numpy", append=True) + tpot_driver(args) ret_stdout = out.getvalue() assert ret_stdout == ""