Docstrings and small name improvements

This commit is contained in:
Pablo Martin 2023-04-24 13:44:11 +02:00
parent 2090ec7c91
commit 467d70fcdc

View file

@ -29,6 +29,12 @@ TEST_LOLACONFIG = build_lolaconfig(flow_name="testing-suite")
@pytest.fixture @pytest.fixture
def connection_with_test_table(): def connection_with_test_table():
"""
Connects to DW, creates a test table in the sandbox env, and yields the
connection to the test.
After the test, the table is dropped and the connection is closed.
"""
test_local_bind_host = "127.0.0.1" test_local_bind_host = "127.0.0.1"
test_local_bind_port = 12345 test_local_bind_port = 12345
@ -87,9 +93,9 @@ def test_sql_transaction_persists_changes_properly(connection_with_test_table):
SELECT a_test_column SELECT a_test_column
FROM sandbox.lolafect_transaction_test_table FROM sandbox.lolafect_transaction_test_table
""") """)
table_has_a_record_after_transaction = bool(cursor.fetchall()) # A non-empty tuple yields True table_has_a_record_after_commit = bool(cursor.fetchall()) # A non-empty tuple yields True
assert table_is_empty_at_first and table_has_a_record_after_transaction assert table_is_empty_at_first and table_has_a_record_after_commit
def test_sql_transaction_rollbacks_changes_properly(connection_with_test_table): def test_sql_transaction_rollbacks_changes_properly(connection_with_test_table):
@ -112,6 +118,6 @@ def test_sql_transaction_rollbacks_changes_properly(connection_with_test_table):
SELECT a_test_column SELECT a_test_column
FROM sandbox.lolafect_transaction_test_table FROM sandbox.lolafect_transaction_test_table
""") """)
table_is_empty_after_rollback = not bool(cursor.fetchall()) # A tuple yields False table_is_still_empty_after_rollback = not bool(cursor.fetchall()) # A tuple yields False
assert table_is_empty_at_first and table_is_empty_after_rollback assert table_is_empty_at_first and table_is_still_empty_after_rollback