Skip to content

Fix sporadic test failures#692

Open
mugiwaraluffy56 wants to merge 1 commit intoaiondemand:developfrom
mugiwaraluffy56:fix/sporadic-test-failures-688
Open

Fix sporadic test failures#692
mugiwaraluffy56 wants to merge 1 commit intoaiondemand:developfrom
mugiwaraluffy56:fix/sporadic-test-failures-688

Conversation

@mugiwaraluffy56
Copy link

Change(s)

Change Type: Fixed

Change Category: Internal

Changelog Entry: Fix sporadic test failures

tests were randomly failing (~2 out of 9 runs), found two issues:

  • logged_in_user() was missing try/finally so if a test failed inside the
    with block, keycloak_openid.introspect never got restored and the mock
    leaked into the next tests (403 instead of 401, mocked requests not firing, etc.)

  • some timestamp comparisons used < instead of <=, on a fast machine the
    timestamps can be equal so the assertion fails

How to Test

run pytest src/tests a few times and check the failures from #688 don't show up

Checklist

  • Tests have been added or updated to reflect the changes, or their absence is explicitly explained.
  • Documentation has been added or updated to reflect the changes, or their absence is explicitly explained.
  • A self review has been conducted checking:
    • No unintended changes have been committed.
    • The changes in isolation seem reasonable.
    • Anything that may be odd or unintuitive is provided with a GitHub comment.
  • All CI checks pass before pinging a reviewer, or provide an explanation if they do not.
  • The PR title matches the changelog entry's one line description.

Related Issues

Closes #688

@mugiwaraluffy56 mugiwaraluffy56 changed the title fixes issue 688 Fix sporadic test failures Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tests]: sporadic test failures in local pytest run

1 participant