Skip to content

Test failures in test_auth.py: sync tests using async fixtures #902

Closed as duplicate of#814
@nandsha

Description

@nandsha

Describe the bug
Two test methods in test_auth.py are using the async oauth_provider fixture but are not marked as async tests, causing AttributeError failures.

To Reproduce
Steps to reproduce the behavior:

  1. Run the test suite with pytest tests/client/test_auth.py
  2. Observe failures for:
    • test_scope_priority_client_metadata_first
    • test_scope_priority_no_client_metadata_scope
  3. See error: AttributeError: 'coroutine' object has no attribute 'client_metadata'

Expected behavior
Tests should run successfully without AttributeError when using async fixtures.

Screenshots
Error output:

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

Environment:

  • OS: Cross-platform issue
  • Python version: 3.10+
  • Package version: Current main branch

Additional context

  • These tests use the async oauth_provider fixture but are synchronous methods
  • The solution is to add @pytest.mark.anyio decorator and convert methods to async def
  • This follows the pattern established in commit 9dad266
  • Note: CI currently has continue-on-error: true for tests, which prevented this from being caught automatically

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions