Clear tasks at the end of test transaction

The tasks list is global per thread. As the tests are run in the same thread,
we must clear remaining tasks that are not run by the test.

Closes #11978
(grafted from 2876d8571c510e7a1afd2c19da2dcebf4ebd0824)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2022-12-31 20:19:20 +01:00
1 parent 4818cc27b0
commit 5799f40108
1 file changed
+2
+2
View File
@@ -204,6 +204,8 @@ def with_transaction(user=1, context=None):
result = func(*args, **kwargs)
finally:
transaction.rollback()
# Clear remaining tasks
transaction.tasks.clear()
# Drop the cache as the transaction is rollbacked
Cache.drop(DB_NAME)
return result