Skip to content

Fix auth tests and ruff format #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged

Fix auth tests and ruff format #818

merged 1 commit into from
May 27, 2025

Conversation

ihrpr
Copy link
Contributor

@ihrpr ihrpr commented May 27, 2025

We started running tests in parallel and this uncovered, strangely see this only in local run.

oauth_provider fixture in the test file is defined as an async fixture (async def oauth_provider), but two tests were trying to use it as a synchronous fixture:

  1. test_has_valid_token_expired - was a synchronous test (def test_...) but used the async oauth_provider fixture
  2. test_scope_priority_no_scope - was also a synchronous test but used the async oauth_provider fixture

This caused an AttributeError because pytest was passing a coroutine object instead of the actual OAuthClientProvider instance to these tests. When the tests tried to access attributes like oauth_provider._current_tokens, they failed because coroutine objects don't have these attributes.

The fix was to make both tests async by:

  • Adding @pytest.mark.anyio decorator
  • Changing def test_... to async def test_...

Also noticed that out CI does not catch ruff format so adding it here

@ihrpr ihrpr merged commit 9dad266 into main May 27, 2025
13 checks passed
@ihrpr ihrpr deleted the ihrpr/local-fixed branch May 27, 2025 16:00
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.

2 participants