Skip to content

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

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

Closed

Conversation

nandsha
Copy link
Contributor

@nandsha nandsha commented Jun 8, 2025

Description

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

Fixes #902

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
Copy link
Contributor Author

nandsha commented Jun 16, 2025

Superseded by upstream PR #879 (commit a2643d3, merged June 3rd). This PR was created with a similar fix on May 31st but is no longer needed. Closing as resolved upstream.

@nandsha nandsha closed this Jun 16, 2025
@nandsha nandsha deleted the fix/async-oauth-tests branch June 29, 2025 03:31
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.

Test failures in test_auth.py: sync tests using async fixtures
1 participant