scikit-learn / scikit-learn

Compare 1da9941 ... +0 ... 5623288

Coverage Reach
linear_model/tests/test_logistic.py linear_model/tests/test_sgd.py linear_model/tests/test_ridge.py linear_model/tests/test_coordinate_descent.py linear_model/tests/test_sag.py linear_model/tests/test_least_angle.py linear_model/tests/test_base.py linear_model/tests/test_ransac.py linear_model/tests/test_sparse_coordinate_descent.py linear_model/tests/test_theil_sen.py linear_model/tests/test_passive_aggressive.py linear_model/tests/test_omp.py linear_model/tests/test_huber.py linear_model/tests/test_bayes.py linear_model/tests/test_perceptron.py linear_model/logistic.py linear_model/ridge.py linear_model/coordinate_descent.py linear_model/stochastic_gradient.py linear_model/least_angle.py linear_model/omp.py linear_model/base.py linear_model/bayes.py linear_model/ransac.py linear_model/theil_sen.py linear_model/huber.py linear_model/sag.py linear_model/passive_aggressive.py linear_model/setup.py linear_model/__init__.py linear_model/perceptron.py utils/tests/test_validation.py utils/tests/test_extmath.py utils/tests/test_sparsefuncs.py utils/tests/test_estimator_checks.py utils/tests/test_testing.py utils/tests/test_pprint.py utils/tests/test_utils.py utils/tests/test_multiclass.py utils/tests/test_class_weight.py utils/tests/test_cython_blas.py utils/tests/test_seq_dataset.py utils/tests/test_random.py utils/tests/test_shortest_path.py utils/tests/test_murmurhash.py utils/tests/test_fixes.py utils/tests/test_metaestimators.py utils/tests/test_deprecation.py utils/tests/test_show_versions.py utils/tests/test_fast_dict.py utils/tests/test_linear_assignment.py utils/tests/test_optimize.py utils/estimator_checks.py utils/testing.py utils/validation.py utils/_pprint.py utils/sparsefuncs.py utils/extmath.py utils/__init__.py utils/multiclass.py utils/fixes.py utils/linear_assignment_.py utils/metaestimators.py utils/_unittest_backport.py utils/optimize.py utils/class_weight.py utils/deprecation.py utils/mocking.py utils/_show_versions.py utils/random.py utils/setup.py utils/graph.py utils/_joblib.py utils/stats.py ensemble/tests/test_gradient_boosting.py ensemble/tests/test_forest.py ensemble/tests/test_bagging.py ensemble/tests/test_voting.py ensemble/tests/test_weight_boosting.py ensemble/tests/test_iforest.py ensemble/tests/test_gradient_boosting_loss_functions.py ensemble/tests/test_partial_dependence.py ensemble/tests/test_base.py ensemble/gradient_boosting.py ensemble/_hist_gradient_boosting/gradient_boosting.py ensemble/_hist_gradient_boosting/grower.py ensemble/_hist_gradient_boosting/loss.py ensemble/_hist_gradient_boosting/binning.py ensemble/_hist_gradient_boosting/predictor.py ensemble/forest.py ensemble/weight_boosting.py ensemble/bagging.py ensemble/_gb_losses.py ensemble/partial_dependence.py ensemble/iforest.py ensemble/voting.py ensemble/base.py ensemble/__init__.py ensemble/setup.py metrics/tests/test_classification.py metrics/tests/test_ranking.py metrics/tests/test_pairwise.py metrics/tests/test_common.py metrics/tests/test_score_objects.py metrics/tests/test_regression.py metrics/cluster/tests/test_supervised.py metrics/cluster/tests/test_unsupervised.py metrics/cluster/tests/test_common.py metrics/cluster/tests/test_bicluster.py metrics/cluster/supervised.py metrics/cluster/unsupervised.py metrics/cluster/bicluster.py metrics/cluster/__init__.py metrics/cluster/setup.py metrics/classification.py metrics/pairwise.py metrics/ranking.py metrics/scorer.py metrics/regression.py metrics/__init__.py metrics/base.py metrics/setup.py preprocessing/tests/test_data.py preprocessing/tests/test_encoders.py preprocessing/tests/test_label.py preprocessing/tests/test_imputation.py preprocessing/tests/test_discretization.py preprocessing/tests/test_common.py preprocessing/tests/test_function_transformer.py preprocessing/tests/test_base.py preprocessing/data.py preprocessing/_encoders.py preprocessing/label.py preprocessing/imputation.py preprocessing/_discretization.py preprocessing/_function_transformer.py preprocessing/base.py preprocessing/__init__.py preprocessing/setup.py tests/test_pipeline.py tests/test_impute.py tests/test_multiclass.py tests/test_dummy.py tests/test_naive_bayes.py tests/test_multioutput.py tests/test_base.py tests/test_isotonic.py tests/test_discriminant_analysis.py tests/test_calibration.py tests/test_random_projection.py tests/test_kernel_approximation.py tests/test_common.py tests/test_metaestimators.py tests/test_docstring_parameters.py tests/test_kernel_ridge.py tests/test_config.py tests/test_init.py tests/test_site_joblib.py tests/test_check_build.py model_selection/tests/test_validation.py model_selection/tests/test_search.py model_selection/tests/test_split.py model_selection/tests/common.py model_selection/_split.py model_selection/_validation.py model_selection/_search.py model_selection/__init__.py decomposition/tests/test_pca.py decomposition/tests/test_nmf.py decomposition/tests/test_dict_learning.py decomposition/tests/test_online_lda.py decomposition/tests/test_incremental_pca.py decomposition/tests/test_fastica.py decomposition/tests/test_sparse_pca.py decomposition/tests/test_kernel_pca.py decomposition/tests/test_truncated_svd.py decomposition/tests/test_factor_analysis.py decomposition/nmf.py decomposition/dict_learning.py decomposition/online_lda.py decomposition/fastica_.py decomposition/pca.py decomposition/factor_analysis.py decomposition/kernel_pca.py decomposition/sparse_pca.py decomposition/incremental_pca.py decomposition/truncated_svd.py decomposition/base.py decomposition/setup.py decomposition/__init__.py cluster/tests/test_k_means.py cluster/tests/test_hierarchical.py cluster/tests/test_dbscan.py cluster/tests/test_bicluster.py cluster/tests/test_optics.py cluster/tests/test_spectral.py cluster/tests/test_birch.py cluster/tests/test_affinity_propagation.py cluster/tests/test_mean_shift.py cluster/tests/test_feature_agglomeration.py cluster/tests/common.py cluster/k_means_.py cluster/hierarchical.py cluster/birch.py cluster/bicluster.py cluster/affinity_propagation_.py cluster/mean_shift_.py cluster/spectral.py cluster/optics_.py cluster/dbscan_.py cluster/_feature_agglomeration.py cluster/setup.py cluster/__init__.py datasets/tests/test_openml.py datasets/tests/test_svmlight_format.py datasets/tests/test_samples_generator.py datasets/tests/test_base.py datasets/tests/test_lfw.py datasets/tests/test_mldata.py datasets/tests/test_20news.py datasets/tests/test_rcv1.py datasets/tests/test_kddcup99.py datasets/tests/test_covtype.py datasets/tests/test_california_housing.py datasets/tests/test_common.py datasets/samples_generator.py datasets/openml.py datasets/base.py datasets/twenty_newsgroups.py datasets/lfw.py datasets/svmlight_format.py datasets/rcv1.py datasets/kddcup99.py datasets/mldata.py datasets/species_distributions.py datasets/covtype.py datasets/__init__.py datasets/california_housing.py datasets/olivetti_faces.py datasets/setup.py neighbors/tests/test_neighbors.py neighbors/tests/test_nca.py neighbors/tests/test_ball_tree.py neighbors/tests/test_kd_tree.py neighbors/tests/test_kde.py neighbors/tests/test_lof.py neighbors/tests/test_dist_metrics.py neighbors/tests/test_nearest_centroid.py neighbors/tests/test_quad_tree.py neighbors/base.py neighbors/nca.py neighbors/classification.py neighbors/kde.py neighbors/lof.py neighbors/nearest_centroid.py neighbors/regression.py neighbors/graph.py neighbors/setup.py neighbors/__init__.py neighbors/unsupervised.py tree/tests/test_tree.py tree/tests/test_export.py tree/tests/test_reingold_tilford.py tree/export.py tree/tree.py tree/_reingold_tilford.py tree/setup.py tree/__init__.py feature_extraction/tests/test_text.py feature_extraction/tests/test_image.py feature_extraction/tests/test_feature_hasher.py feature_extraction/tests/test_dict_vectorizer.py feature_extraction/text.py feature_extraction/image.py feature_extraction/dict_vectorizer.py feature_extraction/hashing.py feature_extraction/setup.py feature_extraction/__init__.py feature_extraction/stop_words.py feature_selection/tests/test_feature_select.py feature_selection/tests/test_rfe.py feature_selection/tests/test_from_model.py feature_selection/tests/test_mutual_info.py feature_selection/tests/test_base.py feature_selection/tests/test_chi2.py feature_selection/tests/test_variance_threshold.py feature_selection/univariate_selection.py feature_selection/rfe.py feature_selection/mutual_info_.py feature_selection/from_model.py feature_selection/base.py feature_selection/variance_threshold.py feature_selection/__init__.py manifold/tests/test_t_sne.py manifold/tests/test_spectral_embedding.py manifold/tests/test_locally_linear.py manifold/tests/test_isomap.py manifold/tests/test_mds.py manifold/t_sne.py manifold/locally_linear.py manifold/spectral_embedding_.py manifold/mds.py manifold/isomap.py manifold/setup.py manifold/__init__.py gaussian_process/kernels.py gaussian_process/tests/test_gpr.py gaussian_process/tests/test_kernels.py gaussian_process/tests/test_gpc.py gaussian_process/gpc.py gaussian_process/gpr.py gaussian_process/correlation_models.py gaussian_process/regression_models.py gaussian_process/__init__.py mixture/tests/test_gaussian_mixture.py mixture/tests/test_bayesian_mixture.py mixture/tests/test_mixture.py mixture/gaussian_mixture.py mixture/base.py mixture/bayesian_mixture.py mixture/__init__.py svm/tests/test_svm.py svm/tests/test_sparse.py svm/tests/test_bounds.py svm/base.py svm/classes.py svm/setup.py svm/bounds.py svm/__init__.py neural_network/tests/test_mlp.py neural_network/tests/test_rbm.py neural_network/tests/test_stochastic_optimizers.py neural_network/multilayer_perceptron.py neural_network/rbm.py neural_network/_stochastic_optimizers.py neural_network/_base.py neural_network/__init__.py covariance/tests/test_covariance.py covariance/tests/test_graphical_lasso.py covariance/tests/test_graph_lasso.py covariance/tests/test_robust_covariance.py covariance/tests/test_elliptic_envelope.py covariance/graph_lasso_.py covariance/robust_covariance.py covariance/shrunk_covariance_.py covariance/empirical_covariance_.py covariance/elliptic_envelope.py covariance/__init__.py compose/tests/test_column_transformer.py compose/tests/test_target.py compose/_column_transformer.py compose/_target.py compose/__init__.py impute.py cross_decomposition/pls_.py cross_decomposition/tests/test_pls.py cross_decomposition/cca_.py cross_decomposition/__init__.py naive_bayes.py pipeline.py multiclass.py discriminant_analysis.py semi_supervised/label_propagation.py semi_supervised/tests/test_label_propagation.py semi_supervised/__init__.py base.py multioutput.py dummy.py calibration.py kernel_approximation.py isotonic.py _build_utils/openmp_helpers.py _build_utils/__init__.py random_projection.py setup.py kernel_ridge.py __init__.py __check_build/__init__.py __check_build/setup.py _config.py experimental/tests/test_enable_hist_gradient_boosting.py experimental/enable_hist_gradient_boosting.py exceptions.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -1,70 +1,8 @@
Loading
1 1
"""Tests for making sure experimental imports work as expected."""
2 2
3 -
import sys
4 -
import os
5 -
import os.path as op
6 3
import textwrap
7 -
import tempfile
8 -
from subprocess import check_output, STDOUT, CalledProcessError
9 -
from subprocess import TimeoutExpired
10 4
11 -
12 -
def assert_run_python_script(source_code, timeout=60):
13 -
    """Utility to check assertions in an independent Python subprocess.
14 -
15 -
    The script provided in the source code should return 0 and not print
16 -
    anything on stderr or stdout.
17 -
18 -
    This is a port from cloudpickle https://github.com/cloudpipe/cloudpickle
19 -
20 -
    Parameters
21 -
    ----------
22 -
    source_code : str
23 -
        The Python source code to execute.
24 -
    timeout : int
25 -
        Time in seconds before timeout.
26 -
    """
27 -
    def _make_cwd_env():
28 -
        """Helper to prepare environment for the child processes"""
29 -
        sklearn_repo_folder = op.normpath(
30 -
            op.join(op.dirname(__file__), '../..'))
31 -
        env = os.environ.copy()
32 -
        pythonpath = "{src}{sep}tests{pathsep}{src}".format(
33 -
            src=sklearn_repo_folder, sep=os.sep, pathsep=os.pathsep)
34 -
        env['PYTHONPATH'] = pythonpath
35 -
        return sklearn_repo_folder, env
36 -
37 -
    fd, source_file = tempfile.mkstemp(suffix='_src_test_sklearn.py')
38 -
    os.close(fd)
39 -
    try:
40 -
        with open(source_file, 'wb') as f:
41 -
            f.write(source_code.encode('utf-8'))
42 -
        cmd = [sys.executable, source_file]
43 -
        cwd, env = _make_cwd_env()
44 -
        kwargs = {
45 -
            'cwd': cwd,
46 -
            'stderr': STDOUT,
47 -
            'env': env,
48 -
        }
49 -
        # If coverage is running, pass the config file to the subprocess
50 -
        coverage_rc = os.environ.get("COVERAGE_PROCESS_START")
51 -
        if coverage_rc:
52 -
            kwargs['env']['COVERAGE_PROCESS_START'] = coverage_rc
53 -
54 -
        kwargs['timeout'] = timeout
55 -
        try:
56 -
            try:
57 -
                out = check_output(cmd, **kwargs)
58 -
            except CalledProcessError as e:
59 -
                raise RuntimeError(u"script errored with output:\n%s"
60 -
                                   % e.output.decode('utf-8'))
61 -
            if out != b"":
62 -
                raise AssertionError(out.decode('utf-8'))
63 -
        except TimeoutExpired as e:
64 -
            raise RuntimeError(u"script timeout, output so far:\n%s"
65 -
                               % e.output.decode('utf-8'))
66 -
    finally:
67 -
        os.unlink(source_file)
5 +
from sklearn.utils.testing import assert_run_python_script
68 6
69 7
70 8
def test_imports_strategies():

@@ -17,6 +17,9 @@
Loading
17 17
import warnings
18 18
import sys
19 19
import functools
20 +
import tempfile
21 +
from subprocess import check_output, STDOUT, CalledProcessError
22 +
from subprocess import TimeoutExpired
20 23
21 24
22 25
import scipy as sp
@@ -83,7 +86,8 @@
Loading
83 86
           "assert_array_almost_equal", "assert_array_less",
84 87
           "assert_less", "assert_less_equal",
85 88
           "assert_greater", "assert_greater_equal",
86 -
           "assert_approx_equal", "assert_allclose", "SkipTest"]
89 +
           "assert_approx_equal", "assert_allclose",
90 +
           "assert_run_python_script", "SkipTest"]
87 91
__all__.extend(additional_names_in_all)
88 92
89 93
_dummy = TestCase('__init__')
@@ -971,3 +975,61 @@
Loading
971 975
            if n1 != n2:
972 976
                incorrect += [func_name + ' ' + n1 + ' != ' + n2]
973 977
    return incorrect
978 +
979 +
980 +
def assert_run_python_script(source_code, timeout=60):
981 +
    """Utility to check assertions in an independent Python subprocess.
982 +
983 +
    The script provided in the source code should return 0 and not print
984 +
    anything on stderr or stdout.
985 +
986 +
    This is a port from cloudpickle https://github.com/cloudpipe/cloudpickle
987 +
988 +
    Parameters
989 +
    ----------
990 +
    source_code : str
991 +
        The Python source code to execute.
992 +
    timeout : int
993 +
        Time in seconds before timeout.
994 +
    """
995 +
    def _make_cwd_env():
996 +
        """Helper to prepare environment for the child processes"""
997 +
        sklearn_repo_folder = op.normpath(
998 +
            op.join(op.dirname(__file__), '../..'))
999 +
        env = os.environ.copy()
1000 +
        pythonpath = "{src}{sep}tests{pathsep}{src}".format(
1001 +
            src=sklearn_repo_folder, sep=os.sep, pathsep=os.pathsep)
1002 +
        env['PYTHONPATH'] = pythonpath
1003 +
        return sklearn_repo_folder, env
1004 +
1005 +
    fd, source_file = tempfile.mkstemp(suffix='_src_test_sklearn.py')
1006 +
    os.close(fd)
1007 +
    try:
1008 +
        with open(source_file, 'wb') as f:
1009 +
            f.write(source_code.encode('utf-8'))
1010 +
        cmd = [sys.executable, source_file]
1011 +
        cwd, env = _make_cwd_env()
1012 +
        kwargs = {
1013 +
            'cwd': cwd,
1014 +
            'stderr': STDOUT,
1015 +
            'env': env,
1016 +
        }
1017 +
        # If coverage is running, pass the config file to the subprocess
1018 +
        coverage_rc = os.environ.get("COVERAGE_PROCESS_START")
1019 +
        if coverage_rc:
1020 +
            kwargs['env']['COVERAGE_PROCESS_START'] = coverage_rc
1021 +
1022 +
        kwargs['timeout'] = timeout
1023 +
        try:
1024 +
            try:
1025 +
                out = check_output(cmd, **kwargs)
1026 +
            except CalledProcessError as e:
1027 +
                raise RuntimeError(u"script errored with output:\n%s"
1028 +
                                   % e.output.decode('utf-8'))
1029 +
            if out != b"":
1030 +
                raise AssertionError(out.decode('utf-8'))
1031 +
        except TimeoutExpired as e:
1032 +
            raise RuntimeError(u"script timeout, output so far:\n%s"
1033 +
                               % e.output.decode('utf-8'))
1034 +
    finally:
1035 +
        os.unlink(source_file)

Learn more Showing 54 files with coverage changes found.

Changes in sklearn/neighbors/setup.py
-13
+13
Loading file...
Changes in sklearn/preprocessing/setup.py
-9
+9
Loading file...
Changes in sklearn/feature_extraction/setup.py
-10
+10
Loading file...
Changes in sklearn/utils/setup.py
-25
+25
Loading file...
Changes in sklearn/ensemble/setup.py
-13
+13
Loading file...
Changes in sklearn/tree/setup.py
-14
+14
Loading file...
Changes in sklearn/manifold/setup.py
-9
+9
Loading file...
Changes in sklearn/datasets/setup.py
-10
+10
Loading file...
Changes in sklearn/metrics/setup.py
-8
+8
Loading file...
Changes in sklearn/tests/test_docstring_parameters.py
-46
+46
Loading file...
Changes in sklearn/decomposition/setup.py
-8
+8
Loading file...
Changes in sklearn/linear_model/setup.py
-13
+13
Loading file...
Changes in sklearn/metrics/cluster/setup.py
-7
+7
Loading file...
Changes in sklearn/__check_build/setup.py
-4
+4
Loading file...
Changes in sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py
-86
+86
Loading file...
Changes in sklearn/utils/fixes.py
-41
+41
Loading file...
Changes in sklearn/_build_utils/__init__.py
-15
+15
Loading file...
Changes in sklearn/ensemble/_hist_gradient_boosting/predictor.py
-5
+5
Loading file...
Changes in sklearn/ensemble/_hist_gradient_boosting/loss.py
-16
+16
Loading file...
Changes in sklearn/compose/tests/test_column_transformer.py
-96
+96
Loading file...
Changes in sklearn/utils/testing.py
-47
+47
Loading file...
Changes in sklearn/manifold/spectral_embedding_.py
-15
+15
Loading file...
Changes in sklearn/ensemble/_hist_gradient_boosting/binning.py
-4
+4
Loading file...
Changes in sklearn/utils/tests/test_utils.py
-14
+14
Loading file...
Changes in sklearn/utils/tests/test_testing.py
-19
+19
Loading file...
Changes in sklearn/_build_utils/openmp_helpers.py
-4
+4
Loading file...
Changes in sklearn/ensemble/_hist_gradient_boosting/grower.py
-13
+13
Loading file...
Changes in sklearn/compose/_column_transformer.py
-16
+16
Loading file...
Changes in sklearn/preprocessing/tests/test_encoders.py
-29
+29
Loading file...
Changes in sklearn/utils/tests/test_estimator_checks.py
-17
+17
Loading file...
Changes in sklearn/utils/tests/test_validation.py
-25
+25
Loading file...
Changes in sklearn/preprocessing/tests/test_function_transformer.py
-4
+4
Loading file...
Changes in sklearn/manifold/tests/test_spectral_embedding.py
-5
+5
Loading file...
Changes in sklearn/cluster/tests/test_spectral.py
-3
+3
Loading file...
Changes in sklearn/tests/test_impute.py
-12
+12
Loading file...
Changes in sklearn/utils/tests/test_multiclass.py
-3
+3
Loading file...
Changes in sklearn/utils/deprecation.py
-1
+1
Loading file...
Changes in sklearn/utils/validation.py
-3
+3
Loading file...
Changes in sklearn/svm/classes.py
-1
+1
Loading file...
Changes in sklearn/metrics/pairwise.py
-3
+3
Loading file...
Changes in sklearn/linear_model/ridge.py
-4
+4
Loading file...
Changes in sklearn/neighbors/tests/test_dist_metrics.py
-1
+1
Loading file...
Changes in sklearn/utils/multiclass.py
-1
+1
Loading file...
Changes in sklearn/utils/estimator_checks.py
-10
+10
Loading file...
Changes in sklearn/gaussian_process/gpr.py
-1
+1
Loading file...
Changes in sklearn/metrics/cluster/supervised.py
-1
+1
Loading file...
Changes in sklearn/preprocessing/_encoders.py
-2
+2
Loading file...
Changes in sklearn/model_selection/tests/test_validation.py
-5
+5
Loading file...
Changes in sklearn/tree/export.py
-1
+1
Loading file...
Changes in sklearn/impute.py
-1
+1
Loading file...
Changes in sklearn/model_selection/tests/test_split.py
-1
+1
Loading file...
Changes in sklearn/model_selection/tests/test_search.py
-1
+1
Loading file...
Changes in sklearn/metrics/tests/test_classification.py
-1
+1
Loading file...
setup.py
Loading file...

2 Commits

Files Coverage
sklearn -1.01% 95.68%
Project Totals (383 files) 95.68%
Loading