Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST: Use deterministic seeds in tests #2230

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions onedal/utils/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# limitations under the License.
# ==============================================================================

import time

import numpy as np
import numpy.random as rand
import pytest
Expand Down Expand Up @@ -65,7 +63,7 @@ def test_sum_infinite_actually_finite(dtype, shape, allow_nan, dataframe, queue)
)
@pytest.mark.parametrize("allow_nan", [False, True])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
@pytest.mark.parametrize(
"dataframe, queue", get_dataframes_and_queues("numpy,dpnp,dpctl")
)
Expand All @@ -92,7 +90,7 @@ def test_assert_finite_random_location(
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
@pytest.mark.parametrize("allow_nan", [False, True])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
@pytest.mark.parametrize(
"dataframe, queue", get_dataframes_and_queues("numpy,dpnp,dpctl")
)
Expand Down Expand Up @@ -120,7 +118,7 @@ def test_assert_finite_random_shape_and_location(
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
@pytest.mark.parametrize("allow_nan", [False, True])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
def test_assert_finite_sparse(dtype, allow_nan, check, seed):
lb, ub = 2, 2056
rand.seed(seed)
Expand Down
8 changes: 3 additions & 5 deletions sklearnex/utils/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# limitations under the License.
# ==============================================================================

import time

import numpy as np
import numpy.random as rand
import pytest
Expand Down Expand Up @@ -67,7 +65,7 @@ def test_sum_infinite_actually_finite(dtype, shape, ensure_all_finite):
)
@pytest.mark.parametrize("ensure_all_finite", ["allow-nan", True])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
@pytest.mark.parametrize(
"dataframe, queue",
get_dataframes_and_queues(_dataframes_supported),
Expand Down Expand Up @@ -110,7 +108,7 @@ def test_validate_data_random_location(
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
@pytest.mark.parametrize("ensure_all_finite", ["allow-nan", True])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
@pytest.mark.parametrize(
"dataframe, queue",
get_dataframes_and_queues(_dataframes_supported),
Expand Down Expand Up @@ -151,7 +149,7 @@ def test_validate_data_random_shape_and_location(

@pytest.mark.parametrize("dtype", [np.float32, np.float64])
@pytest.mark.parametrize("check", ["inf", "NaN", None])
@pytest.mark.parametrize("seed", [0, int(time.time())])
@pytest.mark.parametrize("seed", [0, 123456])
@pytest.mark.parametrize(
"dataframe, queue",
get_dataframes_and_queues(_dataframes_supported),
Expand Down
Loading