Skip to content

Commit

Permalink
Handle failure on master
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger committed Aug 29, 2018
1 parent 4342853 commit d279253
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/driver_tests.py
Expand Up @@ -25,21 +25,25 @@

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:
from io import StringIO

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()
Expand Down Expand Up @@ -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', ',',
Expand All @@ -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 == ""
Expand Down

0 comments on commit d279253

Please sign in to comment.