diff --git a/doc/datasets/conftest.py b/doc/conftest.py similarity index 96% rename from doc/datasets/conftest.py rename to doc/conftest.py index 0ccc0bced9ee7..09e2bc9f9aa8d 100644 --- a/doc/datasets/conftest.py +++ b/doc/conftest.py @@ -65,7 +65,7 @@ def pytest_runtest_setup(item): setup_rcv1() elif fname.endswith('datasets/twenty_newsgroups.rst'): setup_twenty_newsgroups() - elif fname.endswith('datasets/working_with_text_data.rst'): + elif fname.endswith('tutorial/text_analytics/working_with_text_data.rst'): setup_working_with_text_data() diff --git a/doc/datasets/labeled_faces_fixture.py b/doc/datasets/labeled_faces_fixture.py deleted file mode 100644 index 45d9d4dfc672e..0000000000000 --- a/doc/datasets/labeled_faces_fixture.py +++ /dev/null @@ -1,15 +0,0 @@ -"""Fixture module to skip the datasets loading when offline - -Doctests are skipped if the datasets have not already been dowloaded -and cached in the past. -""" -from os.path import exists -from os.path import join -from sklearn.datasets import get_data_home -from sklearn.utils.testing import SkipTest - - -def setup_module(module): - data_home = get_data_home() - if not exists(join(data_home, 'lfw_home')): - raise SkipTest("Skipping dataset loading doctests") diff --git a/doc/datasets/mldata_fixture.py b/doc/datasets/mldata_fixture.py deleted file mode 100644 index 0ee5cccaa0f5e..0000000000000 --- a/doc/datasets/mldata_fixture.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Fixture module to skip the datasets loading when offline - -Mock urllib2 access to mldata.org and create a temporary data folder. -""" - -import numpy as np - -from sklearn.utils.testing import install_mldata_mock -from sklearn.utils.testing import uninstall_mldata_mock - - -def setup_module(): - # setup mock urllib2 module to avoid downloading from mldata.org - install_mldata_mock({ - 'mnist-original': { - 'data': np.empty((70000, 784)), - 'label': np.repeat(np.arange(10, dtype='d'), 7000), - }, - 'iris': { - 'data': np.empty((150, 4)), - }, - 'datasets-uci-iris': { - 'double0': np.empty((150, 4)), - 'class': np.empty((150,)), - }, - }) - - -def teardown_module(): - uninstall_mldata_mock() diff --git a/doc/datasets/rcv1_fixture.py b/doc/datasets/rcv1_fixture.py deleted file mode 100644 index 75d93d7ec568e..0000000000000 --- a/doc/datasets/rcv1_fixture.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Fixture module to skip the datasets loading when offline - -The RCV1 data is rather large and some CI workers such as travis are -stateless hence will not cache the dataset as regular scikit-learn users would do. - -The following will skip the execution of the rcv1.rst doctests -if the proper environment variable is configured (see the source code of -check_skip_network for more details). - -""" -from sklearn.utils.testing import check_skip_network, SkipTest -import os -from sklearn.datasets import get_data_home - - -def setup_module(): - check_skip_network() - - # skip the test in rcv1.rst if the dataset is not already loaded - rcv1_dir = os.path.join(get_data_home(), "RCV1") - if not os.path.exists(rcv1_dir): - raise SkipTest("Download RCV1 dataset to run this test.") - diff --git a/doc/datasets/twenty_newsgroups_fixture.py b/doc/datasets/twenty_newsgroups_fixture.py deleted file mode 100644 index 09e95d621d021..0000000000000 --- a/doc/datasets/twenty_newsgroups_fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Fixture module to skip the datasets loading when offline - -Doctests are skipped if the datasets have not already been downloaded -and cached in the past. -""" -from os.path import exists -from os.path import join - -from sklearn.datasets import get_data_home -from sklearn.utils.testing import SkipTest - - -def setup_module(module): - data_home = get_data_home() - if not exists(join(data_home, '20news_home')): - raise SkipTest("Skipping dataset loading doctests") diff --git a/doc/tutorial/text_analytics/working_with_text_data_fixture.py b/doc/tutorial/text_analytics/working_with_text_data_fixture.py deleted file mode 100644 index d620986d07156..0000000000000 --- a/doc/tutorial/text_analytics/working_with_text_data_fixture.py +++ /dev/null @@ -1,15 +0,0 @@ -"""Fixture module to skip the datasets loading when offline - -The 20 newsgroups data is rather large and some CI workers such as travis are -stateless hence will not cache the dataset as regular scikit-learn users would. - -The following will skip the execution of the working_with_text_data.rst doctests -if the proper environment variable is configured (see the source code of -check_skip_network for more details). - -""" -from sklearn.utils.testing import check_skip_network - - -def setup_module(): - check_skip_network()