TST use global_random_seed in sklearn/cluster/tests/test_dbscan.py
@@ -286,7 +286,7 @@ def test_boundaries():
assert 0 not in core
-def test_weighted_dbscan():
+def test_weighted_dbscan(global_random_seed):
# ensure sample_weight is validated
with pytest.raises(ValueError):
dbscan([[0], [1]], sample_weight=[2])
@@ -320,7 +320,7 @@ def test_weighted_dbscan():
)
# for non-negative sample_weight, cores should be identical to repetition
- rng = np.random.RandomState(42)
+ rng = np.random.RandomState(global_random_seed)
sample_weight = rng.randint(0, 5, X.shape[0])
core1, label1 = dbscan(X, sample_weight=sample_weight)
assert len(label1) == len(X)
