def test_cannot_write_on_read_trans(self, keyfs): key = keyfs.add_key("hello", "hello", dict) tx_1 = Transaction(keyfs) with pytest.raises(keyfs.ReadOnly): tx_1.set(key, {}) with pytest.raises(keyfs.ReadOnly): tx_1.delete(key)
def test_concurrent_tx_sees_original_value_on_delete(self, keyfs): D = keyfs.add_key("NAME", "hello", dict) with keyfs.transaction(write=True): D.set({1:2}) tx_1 = Transaction(keyfs, write=True) tx_2 = Transaction(keyfs) tx_1.delete(D) tx_1.commit() assert tx_2.get(D) == {1:2}