test: add random seed in conftest#1958
Conversation
for more information, see https://pre-commit.ci
|
Can you say a bit more about which tests were failing, and how this contributed to the problems? |
|
hello @manics, I noticed This change keeps the randomization benefits for resource names and ports but ensures the same sequence every time, which is a common practice to make tests predictable and maintainable. I’m hoping this supports the team work on JupyterHub by adding a bit more reliability to our testing setup. Happy to discuss other ideas or tweak this approach! |
|
This account appears to be opening indiscriminate apparently LLM-generated Issues and PRs widely across Python repos without consideration of whether they make sense or the cost to maintainers of dealing with them. Check out many very similar PRs Specific evidence:
|
|
Hey @minrk, Thanks for pointing this out, and I totally understand your concern. These PRs are part of a research project we're conducting, and while we can't share all the details just yet, I want to clarify that each change is reviewed carefully before submission. We're not aiming to create noise or burden maintainers — on the contrary, we hope to contribute positively and learn from the process. Due to the nature of the research, we're required to use an anonymous account for now. However, once the article is published, we'll be able to identify ourselves and share more context around the project and its contributions. That said, we really appreciate feedback like this, and we'll take extra care moving forward to ensure our contributions are clearly beneficial and well-motivated. Thanks again |
This PR adds a fixed
random.seed(42)topytest_configureinconftest.pyto ensure deterministic behavior for tests that rely on Python’s random module.This change was motivated by the
test_registry, which includes logic that uses random. Without setting a seed, test outcomes could vary between runs, making it harder to debug or reproduce issues. By setting the seed once at the start of the test session, we improve consistency and test reliability.