From fcdee74e486a41cf0594496fefe7540d056a9150 Mon Sep 17 00:00:00 2001 From: William Patton Date: Thu, 13 Jun 2024 17:41:35 -0700 Subject: [PATCH] remove excessive seed setting. I don't think this is necessary since as soon as the seeds are set, the rest of the tests are determanistic --- tests/cases/csv_points_source.py | 16 ---------------- tests/cases/shift_augment.py | 8 -------- 2 files changed, 24 deletions(-) diff --git a/tests/cases/csv_points_source.py b/tests/cases/csv_points_source.py index 66ba613a..ec8d88ec 100644 --- a/tests/cases/csv_points_source.py +++ b/tests/cases/csv_points_source.py @@ -24,8 +24,6 @@ def seeds(): @pytest.fixture def test_points_2d(tmpdir): - random.seed(1234) - np.random.seed(1234) fake_points_file = tmpdir / "shift_test.csv" fake_points = np.random.randint(0, 100, size=(2, 2)) @@ -33,19 +31,11 @@ def test_points_2d(tmpdir): for point in fake_points: f.write(str(point[0]) + "\t" + str(point[1]) + "\n") - # This fixture will run after seeds since it is set - # with autouse=True. So make sure to reset the seeds properly at the end - # of this fixture - random.seed(12345) - np.random.seed(12345) - yield fake_points_file, fake_points @pytest.fixture def test_points_3d(tmpdir): - random.seed(1234) - np.random.seed(1234) fake_points_file = tmpdir / "shift_test.csv" fake_points = np.random.randint(0, 100, size=(3, 3)).astype(float) @@ -56,12 +46,6 @@ def test_points_3d(tmpdir): pointdict = {"x": point[0], "y": point[1], "z": point[2], "id": i} writer.writerow(pointdict) - # This fixture will run after seeds since it is set - # with autouse=True. So make sure to reset the seeds properly at the end - # of this fixture - random.seed(12345) - np.random.seed(12345) - yield fake_points_file, fake_points diff --git a/tests/cases/shift_augment.py b/tests/cases/shift_augment.py index b92c71f9..b53b9b4a 100644 --- a/tests/cases/shift_augment.py +++ b/tests/cases/shift_augment.py @@ -33,8 +33,6 @@ def seeds(): @pytest.fixture def test_points(tmpdir): - random.seed(1234) - np.random.seed(1234) fake_points_file = tmpdir / "shift_test.csv" fake_data_file = tmpdir / "shift_test.hdf5" @@ -46,12 +44,6 @@ def test_points(tmpdir): for point in fake_points: f.write(str(point[0]) + "\t" + str(point[1]) + "\n") - # This fixture will run after seeds since it is set - # with autouse=True. So make sure to reset the seeds properly at the end - # of this fixture - random.seed(12345) - np.random.seed(12345) - yield fake_points_file, fake_data_file, fake_points, fake_data