Skip to content

Commit

Permalink
remove excessive seed setting. I don't think this is necessary since …
Browse files Browse the repository at this point in the history
…as soon as the seeds are set, the rest of the tests are determanistic
  • Loading branch information
pattonw committed Jun 14, 2024
1 parent d440f47 commit fcdee74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
16 changes: 0 additions & 16 deletions tests/cases/csv_points_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,18 @@ 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))
with open(fake_points_file, "w") as f:
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)
Expand All @@ -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


Expand Down
8 changes: 0 additions & 8 deletions tests/cases/shift_augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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


Expand Down

0 comments on commit fcdee74

Please sign in to comment.