Skip to content

Commit

Permalink
use deterministic seeds in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes-intel committed Dec 19, 2024
1 parent d9cd092 commit 96aed10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
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

0 comments on commit 96aed10

Please sign in to comment.