Changes between Initial Version and Version 1 of Ticket #31281, comment 1
- Timestamp:
- Feb 17, 2020, 1:37:08 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31281, comment 1
initial v1 1 1 This is a common pitfall (#30601) and closely related or maybe a dupe of #30457. 2 2 3 Only changing the behavior of the test `Client` to perform such operation would be tricky because of the following s etup.3 Only changing the behavior of the test `Client` to perform such operation would be tricky because of the following scenario. 4 4 5 5 … … 12 12 }}} 13 13 14 Would you expect `receiver` to be called or not? I think it could be considered unexpected behaviour in both cases. 14 Would you expect `receiver` to be called or not? I think it could be considered unexpected behaviour in both cases. If it's called then it causes unexpected global state alteration and if it's not, say only `on_commit` receivers attached within the request handling context are handled, you could be in state where the request handling code expect previous `on_commit` handlers to be called. 15 15 16 16 I think we need a solution akind to the `execute_on_commit` [https://code.djangoproject.com/ticket/30457#comment:10 context manager] with `RuntimeWarning` when `transacition.on_commit` is used without ''mocking'' within the context of a `TestCase`.