Skip to content

Set random seed for tests#675

Merged
tsmbland merged 3 commits intomainfrom
test_seed
Mar 18, 2025
Merged

Set random seed for tests#675
tsmbland merged 3 commits intomainfrom
test_seed

Conversation

@tsmbland
Copy link
Copy Markdown
Collaborator

@tsmbland tsmbland commented Mar 14, 2025

Description

We sometimes find that tests randomly fail due to issues with randomly generated test data. Ideally we'd design the tests/fixtures in a way that wasn't so sensitive to this, but for now an easy solution is to set the random seed to a value that we know produces feasible test data.

(I initially tried 0 as the seed and all unit test runs failed, then switched to 123 and they all passed)

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass: $ python -m pytest
  • The documentation builds and looks OK: $ python -m sphinx -b html docs docs/build

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@tsmbland tsmbland marked this pull request as ready for review March 14, 2025 14:12
@tsmbland tsmbland requested a review from dalonsoa March 14, 2025 14:13
@tsmbland tsmbland moved this to 👀 In review in MUSE Mar 17, 2025
@tsmbland tsmbland self-assigned this Mar 18, 2025
Copy link
Copy Markdown
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Theory says that a good seed for a RNG is a large, prime number, but I don't think that's super relevant in this case.

@tsmbland tsmbland merged commit 31d6203 into main Mar 18, 2025
13 of 14 checks passed
@tsmbland tsmbland deleted the test_seed branch March 18, 2025 13:05
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in MUSE Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants