[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-11 Thread Chris Withers
Chris Withers added the comment: Agreed. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-10 Thread Mario Corchero
Mario Corchero added the comment: The reason why it seems that "no arguments are beeing passed" is because the exception is not being raised by you, but by mock itself when the exception is trying to be created. When an exception type is passed as side_effect, the mock modules raises such ex

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-09 Thread Chris Withers
Chris Withers added the comment: Not sure this is correct, if an effect is an exception and requires args, then it should be passed as an instance, not a class: Mock(side_effect=MyException(‘foo’)) > On 10 Nov 2019, at 04:49, Karthikeyan Singaravelan > wrote: > > > Karthikeyan Singaravela

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Currently, the exception is not instantiated. Maybe we can check if it's callable and pass args, kwargs to the exception constructor to be raised. diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index a48132c5b1..f5bcb911f5 100644 --- a/Lib

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-09 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-09 Thread Troulet-lambert Odile
New submission from Troulet-lambert Odile : When patching an Exception with a side_effect to another exception, it seems like the exceiption arguments are not passed to the mock. -- components: Tests files: essai mock_exception.py messages: 356305 nosy: piscvau priority: normal severit