diff --git a/.github/workflows/schedule-dependencies.yml b/.github/workflows/schedule-dependencies.yml index 4f54dd798..c841c2f36 100644 --- a/.github/workflows/schedule-dependencies.yml +++ b/.github/workflows/schedule-dependencies.yml @@ -28,4 +28,4 @@ jobs: - name: Test with pytest run: | pip install -e ".[test]" - pytest -n 2 tests + make test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 442ee9881..7bc6e7ad6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,4 +32,4 @@ jobs: python -m pip install -e ".[test]" - name: Test with pytest run: | - pytest -n 2 tests + make test diff --git a/Makefile b/Makefile index 7cfd40204..f758b8031 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ install: pre-commit install test: - pytest --disable-warnings --cov=sklego + pytest -n auto --disable-warnings --cov=sklego rm -rf .coverage* precommit: diff --git a/sklego/model_selection.py b/sklego/model_selection.py index 040019180..bd65bc6d9 100644 --- a/sklego/model_selection.py +++ b/sklego/model_selection.py @@ -482,10 +482,7 @@ def _iter_test_indices(self, X=None, y=None, groups=None): Train and test indices of the same fold. """ self._check_for_long_estimated_runtime(groups) - ( - self._first_split_index, - self._last_split_index, - ) = self._calc_first_and_last_split_index(groups=groups) + self._first_split_index, self._last_split_index = self._calc_first_and_last_split_index(groups=groups) self._best_splits = self._get_split_indices() groups = self._regroup(groups) for i in range(self.n_splits): diff --git a/tests/test_estimators/test_umap_reconstruction.py b/tests/test_estimators/test_umap_reconstruction.py index 1d7acab53..9e7c220c0 100644 --- a/tests/test_estimators/test_umap_reconstruction.py +++ b/tests/test_estimators/test_umap_reconstruction.py @@ -27,7 +27,7 @@ ), ) def test_estimator_checks(test_fn): - outlier_mod = UMAPOutlierDetection(n_components=2, threshold=0.1) + outlier_mod = UMAPOutlierDetection(n_components=2, threshold=0.1, n_neighbors=3) test_fn(UMAPOutlierDetection.__name__, outlier_mod) @@ -38,6 +38,12 @@ def dataset(): def test_obvious_usecase(dataset): - mod = UMAPOutlierDetection(n_components=2, threshold=7.5, random_state=42, variant="absolute").fit(dataset) + mod = UMAPOutlierDetection( + n_components=2, + threshold=7.5, + random_state=42, + variant="absolute", + n_neighbors=3, + ).fit(dataset) assert mod.predict([[10] * 10]) == np.array([-1]) assert mod.predict([[0.01] * 10]) == np.array([1]) diff --git a/tests/test_model_selection/test_grouptimeseriessplit.py b/tests/test_model_selection/test_grouptimeseriessplit.py index 4ae27e5c5..214f05550 100644 --- a/tests/test_model_selection/test_grouptimeseriessplit.py +++ b/tests/test_model_selection/test_grouptimeseriessplit.py @@ -68,12 +68,12 @@ def test_split_points_chronological(valid_cv): @pytest.mark.parametrize("n_splits, n_groups", [(4, 251), (5, 101), (6, 31), (7, 31)]) def test_user_warning(n_splits, n_groups): - groups = list(range(n_groups)) - X = np.random.randint(1, 10000, size=len(groups)) - y = np.random.randint(1, 10000, size=len(groups)) + groups = range(n_groups) + X, y = np.random.randint(1, 10000, size=(2, n_groups)) + cv = GroupTimeSeriesSplit(n_splits) with pytest.warns(UserWarning): - cv.split(X, y, groups) + cv._check_for_long_estimated_runtime(groups) @pytest.mark.parametrize(