Changes between Initial Version and Version 1 of Ticket #31281, comment 1


Ignore:
Timestamp:
Feb 17, 2020, 1:37:08 PM (5 years ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31281, comment 1

    initial v1  
    11This is a common pitfall (#30601) and closely related or maybe a dupe of #30457.
    22
    3 Only changing the behavior of the test `Client` to perform such operation would be tricky because of the following setup.
     3Only changing the behavior of the test `Client` to perform such operation would be tricky because of the following scenario.
    44
    55
     
    1212}}}
    1313
    14 Would you expect `receiver` to be called or not? I think it could be considered unexpected behaviour in both cases.
     14Would 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.
    1515
    1616I 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`.
Back to Top