Skip to content

[FR] Make tests for db.py #75

@DiFronzo

Description

@DiFronzo

Is your feature request related to a problem? Please describe.
There are currently no automated tests for db.py, making it difficult to ensure that the database connection and utility functions work as intended and to catch regressions during development.

Describe 1~3 use cases of the purposed feature

  • Verify that the SQL class can establish, reuse, and close database connections, and that it properly handles connection timeouts and reconnections.
  • Ensure that the db_conn and db_cursor context managers provide reliable and safe access to the database for various operations.
  • Confirm that the result_iterator function yields results as expected and efficiently handles large result sets.

Describe alternatives you've considered

  • Relying on manual testing or indirect coverage through higher-level tests, but this does not guarantee that all code paths in db.py are exercised.
  • Adding only integration tests, which may not catch issues specific to the database utility logic and error handling.

Additional context
Unit tests for db.py will help maintain code quality and reliability. Tests could be implemented using pytest or unittest, and should cover both typical and edge-case usage of the database connection and utility functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions