Skip to content

fix(tests): fix API test expectations, remove warnings, and clean async test structure#166

Open
Vishmayraj wants to merge 4 commits into
istSOS:mainfrom
Vishmayraj:test/fix-and-clear-warnings
Open

fix(tests): fix API test expectations, remove warnings, and clean async test structure#166
Vishmayraj wants to merge 4 commits into
istSOS:mainfrom
Vishmayraj:test/fix-and-clear-warnings

Conversation

@Vishmayraj
Copy link
Copy Markdown
Contributor

Summary

This PR improves the api/tests suite by aligning tests with current endpoint behavior, removing warnings, and cleaning up async test implementations.

Changes Included

  • Updated test_create_user_unexpected_error_returns_400_without_details to match the current create_user response behavior (400 instead of 500) while still verifying that internal exception details are not exposed.
  • Fixed test_connection_always_closed_even_on_exception to properly simulate a post-acquisition failure path and validate cleanup behavior without coroutine/runtime warnings.
  • Removed unnecessary global asyncio markers from synchronous tests in test_set_role_sql_safety.py.
  • Refactored async tests in test_set_role_sql_safety.py to use native pytest.mark.asyncio + await instead of asyncio.run(...).

Result

  • Full suite passes locally.
  • Warning count reduced to zero.
  • Test behavior now better reflects actual runtime paths and expected responses.

Additional Note

The api/tests directory is currently somewhat fragmented in structure and repeats setup logic (environment variables, path setup, fixtures). If helpful, I’d be happy to contribute a follow-up PR to gradually migrate these tests into the repository root tests/ directory so they can share conftest.py, common fixtures, and a more maintainable layout.

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