1515
1616# helper function
1717def reset_db (db_context : psycopg .Connection | sqlite3 .Connection ):
18+ """Empty all tables inside the database to provide a clean slate for the next test."""
1819 # cleanup_cursor.execute("DROP DATABASE postgres")
1920 # cleanup_cursor.execute("CREATE DATABASE postgres")
2021 cleanup_cursor = db_context .cursor ()
@@ -34,6 +35,7 @@ def reset_db(db_context: psycopg.Connection | sqlite3.Connection):
3435
3536@pytest .fixture ()
3637def connected_PostgresDBHandler ():
38+ """Provide a DBHandler connected to a Postgres database."""
3739 os .environ ["PYTEST_MONITOR_DB_NAME" ] = "postgres"
3840 os .environ ["PYTEST_MONITOR_DB_USER" ] = "postgres"
3941 os .environ ["PYTEST_MONITOR_DB_PASSWORD" ] = "testing_db"
@@ -46,6 +48,7 @@ def connected_PostgresDBHandler():
4648
4749
4850def test_sqlite_handler ():
51+ """Test for working sqlite database"""
4952 # db handler
5053 db = SqliteDBHandler (":memory:" )
5154 session , metrics , exc_context = db .query (
@@ -57,6 +60,7 @@ def test_sqlite_handler():
5760
5861
5962def test_postgres_handler (connected_PostgresDBHandler ):
63+ """Test for working postgres database"""
6064 db = connected_PostgresDBHandler
6165 tables = db .query (
6266 "SELECT tablename FROM pg_tables where schemaname='public'" ,
0 commit comments