Skip to content

Scikit-learn 0.21.1 strange failure using nosetests with import train_test_split #13943

Closed
@trevorstephens

Description

Description

Hey there, I run a simple test suite using nose over my package gplearn and the CRON scheduled tests came up with a failure today. I narrowed the test scopes and removed the test that used that function in a dummy PR on my package and it appears simply importing test_train_split in the test code causes a failure. This only occurs with nosetests, pytest shows no failures locally, while pytest passes cleanly locally. My local configuration is linux, built from source. My travis config is all on pre-built conda packages.

This issue does not occur when running things as code, only through nosetest that I can tell. Tests using test_train_split pass just fine, but then a new "test" appears automagically that fails right after the test file has completed all other tests in the file.

The reason this is happening is a bit of a mystery to me, I don't think I'm doing anything unusual in my test configuration. #13483 appears to be the only recent PR to touch this code. I don't see any reason why that should produce these results though.

See here for the failures which only occur on 0.21.1: https://travis-ci.org/trevorstephens/gplearn/builds/537063072 which is running trevorstephens/gplearn#167

Steps/Code to Reproduce

from sklearn.model_selection import train_test_split

def test_unrelated_fail():

    return None

nosetest -v -s test.py

Expected Results

No error is thrown due to simply importing test_train_split

Actual Results

======================================================================
ERROR: Split arrays or matrices into random train and test subsets
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/trev/.virtualenvs/ve3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/trev/.virtualenvs/ve3/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
    return func(*arg, **kw)
  File "/bigdrive/git/scikit-learn/sklearn/model_selection/_split.py", line 2086, in train_test_split
    raise ValueError("At least one array required as input")
ValueError: At least one array required as input

----------------------------------------------------------------------

Versions

Seems to only affect 0.21.1 on both python 3.6, 3.7

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions