Example #1
0
def test_temporary_settings_object_restore(conn):
    old = TransactionSettings(durability=42)
    new = TransactionSettings(durability=7)
    conn.setTransactionSettings(old)
    with conn.temporaryTransactionSettings(new):
        pass
    assert conn.getTransactionSettings() == old
Example #2
0
def test_temporary_settings_nonlocal_return(conn):
    old = TransactionSettings(durability=42)
    new = TransactionSettings(durability=7)
    conn.setTransactionSettings(old)
    while True:
        with conn.temporaryTransactionSettings(new):
            break
    assert conn.getTransactionSettings() == old
Example #3
0
def test_temporary_settings_object_and_kwargs(conn):
    old = TransactionSettings(durability=42)
    new = TransactionSettings(durability=7)
    conn.setTransactionSettings(old)
    with conn.temporaryTransactionSettings(new, transaction_latency_count=100):
        assert conn.getTransactionSettings().durability == 7
        assert conn.getTransactionSettings().transaction_latency_count == 100
    assert conn.getTransactionSettings() == old
Example #4
0
def test_settings_object_and_kwargs(conn):
    conn.setTransactionSettings(durability=42)
    conn.setTransactionSettings(
        TransactionSettings(transaction_latency_count=7),
        transaction_latency_timeout=2000)
    assert conn.getTransactionSettings().transaction_latency_count == 7
    assert conn.getTransactionSettings().transaction_latency_timeout == 2000
    assert conn.getTransactionSettings().durability is None
Example #5
0
def test_temporary_settings_object_and_kwargs_overwrites_all(conn):
    old = TransactionSettings(durability=42)
    new = TransactionSettings()
    conn.setTransactionSettings(old)
    with conn.temporaryTransactionSettings(new, transaction_latency_count=7):
        assert conn.getTransactionSettings().durability is None
Example #6
0
def test_temporary_settings_kwargs_overwrite(conn):
    old = TransactionSettings(durability=42, transaction_latency_count=10)
    conn.setTransactionSettings(old)
    with conn.temporaryTransactionSettings(durability=7):
        assert conn.getTransactionSettings().durability == 7
        assert conn.getTransactionSettings().transaction_latency_count == 10
Example #7
0
def test_temporary_settings_object(conn):
    new = TransactionSettings(durability=7)
    with conn.temporaryTransactionSettings(new):
        assert conn.getTransactionSettings() == new
Example #8
0
def test_settings_object_and_kwargs_overwrite(conn):
    conn.setTransactionSettings(TransactionSettings(durability=7),
                                durability=42)
    assert conn.getTransactionSettings().durability == 42
Example #9
0
def test_set_settings_object(conn):
    conn.setTransactionSettings(durability=42)
    conn.setTransactionSettings(
        TransactionSettings(transaction_latency_count=7))
    assert conn.getTransactionSettings().transaction_latency_count == 7
    assert conn.getTransactionSettings().durability is None