[issue30541] Add restricted mocks to the python unittest mocking framework

2018-01-05 Thread Paul Ganssle
Change by Paul Ganssle : -- pull_requests: +4974 ___ Python tracker ___ ___

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-10-17 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-10-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 552be9d7e64f91b8e4ba5b29cd5dcc442d56f92c by Victor Stinner (Mario Corchero) in branch 'master': bpo-30541: Add new method to seal mocks (GH61923)

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-09-04 Thread STINNER Victor
STINNER Victor added the comment: I will merge the PR this week, the PR now LGTM. -- ___ Python tracker ___

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-24 Thread László Kiss Kollár
Changes by László Kiss Kollár : -- nosy: +László Kiss Kollár ___ Python tracker ___

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-23 Thread STINNER Victor
STINNER Victor added the comment: > I don't like the idea of an additional Mock class for this. Hum, in the current implementation, it's an enhancement of the Mock class, no more a new class. -- ___ Python tracker

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-23 Thread Michael Foord
Michael Foord added the comment: Note that you can use an object as the parameter to the spec argument rather than just a list of attributes. Hmmm... I'm not totally opposed to the addition of a "seal_mock" method (optionally with a recurse boolean for child mocks) being added to the

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-21 Thread STINNER Victor
STINNER Victor added the comment: > I don't see what this buys over spec and autospec. I'd be inclined to close > it without a compelling use case beyond what is already supported. I proposed to Mario to open an issue since I like his API. Even if "sealing" mocks is unlikely to be the most

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-21 Thread Michael Foord
Michael Foord added the comment: I don't see what this buys over spec and autospec. I'd be inclined to close it without a compelling use case beyond what is already supported. -- ___ Python tracker

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-21 Thread Mario Corchero
Mario Corchero added the comment: Whilst I agree that using spec can be used for a similar purpose and I did not know about being able to do nested definitions via the arguments (the **{"method1.return_value": 1}, really cool!) I find the idea of allowing users to halt the mock generation

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-21 Thread Grzegorz Grzywacz
Grzegorz Grzywacz added the comment: Existing mock implementation already has that feature. Mock attributes can be limited with `spec` attribute. >>> inner_m = Mock(spec=["method2"], **{"method2.return_value": 1}) >>> m = Mock(spec=["method1"], **{"method1.return_value": inner_m}) >>> >>>

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-15 Thread Berker Peksag
Berker Peksag added the comment: I personally never need this feature before so I will add Michael and Robert to nosy list to take their opinions. -- nosy: +berker.peksag, michael.foord, rbcollins stage: -> patch review ___ Python tracker

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-02 Thread Mario Corchero
Changes by Mario Corchero : -- pull_requests: +2003 ___ Python tracker ___ ___

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Eric N. Vander Weele
Changes by Eric N. Vander Weele : -- nosy: +ericvw ___ Python tracker ___ ___

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Mario Corchero
Mario Corchero added the comment: Sample implementation using the new class: https://github.com/mariocj89/cpython/commit/2f13963159e239de041cd68273b9fc4a2aa778cd Sample implementation using the new function to seal existing mocks:

[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Mario Corchero
New submission from Mario Corchero: Define a way to disable the automatic generation of submocks when accessing an attribute of a mock which is not set. Rationale: Inspired by GMock RestrictedMock, it aims to allow the developer to declare a narrow interface to the mock that defines what the