websauna.tests.model.test_retry module¶
Test SQL transaction conflict resolution.
-
class
websauna.tests.model.test_retry.
ConflictResolverThread
(dbsession_factory)[source]¶ Bases:
threading.Thread
Launch two of these and they should cause database conflict and then retryable resolves it.
-
run
()[source]¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
-
class
websauna.tests.model.test_retry.
ConflictThread
(session_factory)[source]¶ Bases:
threading.Thread
Launch two of these and they should cause database conflict.
-
run
()[source]¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
-
websauna.tests.model.test_retry.
test_conflict_resolved
(test_instance, dbsession_factory, dbsession)[source]¶ Use conflict resolver to resolve conflict between two transactions and see code retry is correctly run.
-
websauna.tests.model.test_retry.
test_conflict_some_other_exception
(dbsession)[source]¶ See that unknown exceptions are correctly reraised by managed_transaction.