Skip to content

Fix: Convert sync tests using async fixtures to async tests #863

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nandsha
Copy link

@nandsha nandsha commented May 31, 2025

Description

This PR fixes test failures in test_auth.py where two synchronous test methods were incorrectly using an async fixture.

Problem

Two test methods were using the async oauth_provider fixture but were not marked as async tests:

  • test_scope_priority_client_metadata_first
  • test_scope_priority_no_client_metadata_scope

This caused:

AttributeError: 'coroutine' object has no attribute 'client_metadata'

Solution

Added @pytest.mark.anyio decorator and converted both methods to async def, following the pattern established in commit 9dad266.

Testing

  • ✅ Both fixed tests now pass
  • ✅ All tests pass locally (except one unrelated flaky test)
  • ✅ Linting passes (uv run ruff check)
  • ✅ Formatting checked (uv run ruff format)
  • ✅ Type checking passes (uv run pyright)

Note

The CI currently has continue-on-error: true for tests, which is why these failures weren't caught. This might be worth addressing in a separate issue.

Two test methods in test_auth.py were using the async oauth_provider fixture
but were not marked as async tests:
- test_scope_priority_client_metadata_first
- test_scope_priority_no_client_metadata_scope

This caused AttributeError: 'coroutine' object has no attribute 'client_metadata'
when running tests locally with pytest-anyio.

Added @pytest.mark.anyio decorator and converted both methods to async,
following the pattern established in commit 9dad266.
@nandsha nandsha marked this pull request as ready for review May 31, 2025 07:09
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.

1 participant