kvesteri/sqlalchemy-continuum — pull request #41 by nikola-kocic (2014-02-18 18:15:18+00:00)
Title: Crash if session was flushed before commit (with validity strategy)

Issue #39 is fixed only for subquery strategy

This test crashes with
```python
E IntegrityError: (IntegrityError) duplicate key value violates unique constraint "article_history_pkey"
E DETAIL: Key (id, transaction_id)=(1, 1) already exists.
E 'INSERT INTO article_history (id, name, content, description, transaction_id, end_transaction_id, operation_type) VALUES (%(id)s, %(name)s, %(content)s, %(description)s, %(transaction_id)s, %(end_transaction_id)s, %(operation_type)s)' {'name': u'Some article', 'content': u'Some content', 'end_transaction_id': None, 'operation_type': 0, 'id': 1, 'transaction_id': 1L, 'description': None}
```
```diff
diff --git a/tests/test_exotic_operation_combos.py b/tests/test_exotic_operation_combos.py
index 60f86ba..d0c1023 100644
--- a/tests/test_exotic_operation_combos.py
+++ b/tests/test_exotic_operation_combos.py
@@ -64,3 +64,7 @@ class TestExoticOperationCombos(TestCase):
assert article2.versions.count() == 2
assert article2.versions[0].operation_type == 0
assert article2.versions[1].operation_type == 1
+
+
+class TestExoticOperationCombosWithValidityStrategy(TestExoticOperationCombos):
+ versioning_strategy = 'validity'
```