Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CopyingMock to mock.py #73034

Closed
wimglenn mannequin opened this issue Dec 1, 2016 · 4 comments
Closed

Add CopyingMock to mock.py #73034

wimglenn mannequin opened this issue Dec 1, 2016 · 4 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@wimglenn
Copy link
Mannequin

wimglenn mannequin commented Dec 1, 2016

BPO 28848
Nosy @berkerpeksag, @wimglenn
Files
  • copying_mock.diff: example impl
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-01-06.00:24:30.105>
    created_at = <Date 2016-12-01.05:43:38.191>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Add CopyingMock to mock.py'
    updated_at = <Date 2017-01-06.00:24:30.103>
    user = 'https://github.com/wimglenn'

    bugs.python.org fields:

    activity = <Date 2017-01-06.00:24:30.103>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-01-06.00:24:30.105>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2016-12-01.05:43:38.191>
    creator = 'wim.glenn'
    dependencies = []
    files = ['45715']
    hgrepos = []
    issue_num = 28848
    keywords = ['patch']
    message_count = 4.0
    messages = ['282136', '282137', '284770', '284790']
    nosy_count = 2.0
    nosy_names = ['berker.peksag', 'wim.glenn']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue28848'
    versions = ['Python 3.7']

    @wimglenn
    Copy link
    Mannequin Author

    wimglenn mannequin commented Dec 1, 2016

    Would people be interested to consider adding the CopyingMock example shown in the documentation section "coping with mutable arguments" into the mock module?

    https://docs.python.org/3/library/unittest.mock-examples.html#coping-with-mutable-arguments

    It seems like a useful and simple enough feature to add.

    @wimglenn wimglenn mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Dec 1, 2016
    @wimglenn
    Copy link
    Mannequin Author

    wimglenn mannequin commented Dec 1, 2016

    Here's a first attempt at a patch.

    If it doesn't go into Lib finally, I'll just put up a CopyingMock on pypi instead. But it seemed like the kind of feature which should just be in mock directly rather than 3rd party, preferably.

    @wimglenn
    Copy link
    Mannequin Author

    wimglenn mannequin commented Jan 5, 2017

    Guess there was no interest in this. I've released it on pypi instead (pip install copyingmock).

    https://github.com/wimglenn/copyingmock

    @berkerpeksag
    Copy link
    Member

    Thanks for releasing it on PyPI! It's probably better to keep it as an example in the documentation for now. We can reopen this if there's a demand for CopyingMock in the future.

    @berkerpeksag berkerpeksag added the type-feature A feature request or enhancement label Jan 6, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant