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

Enhance swap_attr() and swap_item() in test.support #74383

Closed
serhiy-storchaka opened this issue Apr 28, 2017 · 6 comments
Closed

Enhance swap_attr() and swap_item() in test.support #74383

serhiy-storchaka opened this issue Apr 28, 2017 · 6 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 30197
Nosy @vstinner, @ezio-melotti, @voidspace, @serhiy-storchaka
PRs
  • bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. #1341
  • [3.6] bpo-30197: Enhance functions swap_attr() and swap_item() in tes… #1345
  • [3.5] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341) #1346
  • [2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in test.test_support. (#1341) #1347
  • 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-04-28.17:07:22.174>
    created_at = <Date 2017-04-28.11:06:00.937>
    labels = ['3.7', 'type-feature', 'tests']
    title = 'Enhance swap_attr() and swap_item() in test.support'
    updated_at = <Date 2020-10-06.10:48:50.555>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2020-10-06.10:48:50.555>
    actor = 'wburchill7'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-04-28.17:07:22.174>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2017-04-28.11:06:00.937>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30197
    keywords = []
    message_count = 6.0
    messages = ['292527', '292536', '292539', '292541', '292542', '378109']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'ezio.melotti', 'michael.foord', 'serhiy.storchaka', 'wburchill7']
    pr_nums = ['1341', '1345', '1346', '1347']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30197'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch adds two features to functions swap_attr() and swap_item() in the test.support module.

    1. They now work (rather than failing in __exit__) when delete the attribute or item inside the with block. There were several cases when I refused to use these functions instead of manually coded try/finally due to lack of this feature.

    2. The original value of the attribute or item can be assigned to the target of "as" in the with statement. This can save a line of the code in some cases.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Apr 28, 2017
    @vstinner
    Copy link
    Member

    New changeset d1a1def by Victor Stinner (Serhiy Storchaka) in branch 'master':
    bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (bpo-1341)
    d1a1def

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 712114b by Serhiy Storchaka in branch '3.6':
    [3.6] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (GH-1341) (bpo-1345)
    712114b

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 910ba93 by Serhiy Storchaka in branch '3.5':
    [3.5] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (bpo-1341) (bpo-1346)
    910ba93

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 941ea53 by Serhiy Storchaka in branch '2.7':
    [2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in test.test_support. (bpo-1341) (bpo-1347)
    941ea53

    @wburchill7
    Copy link
    Mannequin

    wburchill7 mannequin commented Oct 6, 2020

    Thought I'd send

    @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 tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants