convert connect() into a context manager

This commit is contained in:
Sarah Hoffmann
2021-02-23 10:11:21 +01:00
parent 204fe20b4b
commit e520613362
12 changed files with 53 additions and 59 deletions

View File

@@ -11,9 +11,8 @@ SQL_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
@pytest.fixture
def db(temp_db):
conn = connect('dbname=' + temp_db)
yield conn
conn.close()
with connect('dbname=' + temp_db) as conn:
yield conn
@pytest.fixture
def db_with_tables(db):