-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Closed
Labels
ModerateAnything that requires some knowledge of conventions and best practicesAnything that requires some knowledge of conventions and best practicesSprintmodule:datasetsmodule:test-suiteeverything related to our testseverything related to our tests
Description
Running the tests on opeml datasets throws a number of ResourceWarning
in the last development version
Step to reproduce the issue
$ pytest -v sklearn/datasets/tests/test_openml.py -Werror
Expected result
The tests pass
Actual result
The tests fail with messages like
E Traceback (most recent call last):
E File "/home/cmarmo/software/scikit-learn/sklearn/datasets/_openml.py", line 59, in wrapper
E return f(*args, **kw)
E ResourceWarning: unclosed file <_io.BufferedReader name='/home/cmarmo/software/scikit-learn/sklearn/datasets/tests/data/openml/2/api-v1-json-data-qualities-2.json.gz'>
Additional comments
-
The exception seems to be always thrown from
sklearn/datasets/_openml.py
from the wrapper function:
scikit-learn/sklearn/datasets/_openml.py
Lines 57 to 70 in 74a37de
def wrapper(*args, **kw): if data_home is None: return f(*args, **kw) try: return f(*args, **kw) except HTTPError: raise except Exception: warn("Invalid cache, redownloading file", RuntimeWarning) local_path = _get_local_path(openml_path, data_home) if os.path.exists(local_path): os.unlink(local_path) return f(*args, **kw) return wrapper -
Please open one PR for each test file with a failure reported with the command above instead of one single PR that tries to fix everything at once.
Metadata
Metadata
Assignees
Labels
ModerateAnything that requires some knowledge of conventions and best practicesAnything that requires some knowledge of conventions and best practicesSprintmodule:datasetsmodule:test-suiteeverything related to our testseverything related to our tests