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

Everything in Mock should inherit from Base #82289

Closed
lisroach opened this issue Sep 11, 2019 · 4 comments
Closed

Everything in Mock should inherit from Base #82289

lisroach opened this issue Sep 11, 2019 · 4 comments
Assignees
Labels
3.8 only security fixes 3.9 only security fixes

Comments

@lisroach
Copy link
Contributor

BPO 38108
Nosy @ezio-melotti, @voidspace, @lisroach, @tirkarthi
PRs
  • bpo-38108: Makes mock objects inherit from Base #16060
  • [3.8] bpo-38108: Makes mock objects inherit from Base (GH-16060) #16470
  • 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 = 'https://github.com/lisroach'
    closed_at = <Date 2019-09-30.04:21:10.488>
    created_at = <Date 2019-09-11.13:24:30.491>
    labels = ['3.8', '3.9']
    title = 'Everything in Mock should inherit from Base'
    updated_at = <Date 2019-09-30.04:21:10.488>
    user = 'https://github.com/lisroach'

    bugs.python.org fields:

    activity = <Date 2019-09-30.04:21:10.488>
    actor = 'lisroach'
    assignee = 'lisroach'
    closed = True
    closed_date = <Date 2019-09-30.04:21:10.488>
    closer = 'lisroach'
    components = []
    creation = <Date 2019-09-11.13:24:30.491>
    creator = 'lisroach'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38108
    keywords = ['patch']
    message_count = 4.0
    messages = ['351863', '351886', '353478', '353530']
    nosy_count = 4.0
    nosy_names = ['ezio.melotti', 'michael.foord', 'lisroach', 'xtreak']
    pr_nums = ['16060', '16470']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38108'
    versions = ['Python 3.8', 'Python 3.9']

    @lisroach
    Copy link
    Contributor Author

    Everything within Mock should be inheriting from the top-level parent class, Base (and properly call super).

    For multiple inheritance to work correctly they all should be inheriting from the same parent class ultimately.

    Classes that need update:

    MagicMixin
    AsyncMagicMixin
    NonCallableMock (instance = object.__new__(new) should be switched to a super call here)

    @lisroach lisroach added 3.8 only security fixes 3.9 only security fixes labels Sep 11, 2019
    @lisroach lisroach self-assigned this Sep 11, 2019
    @lisroach
    Copy link
    Contributor Author

    Also:

    _AsyncIterator
    _AwaitEvent

    Some of the code in AsyncMagicMixin might be able to be simplified if we inherit from MagicMixin instead, right now we might be duplicating work.

    In general we have to watch out for duplication/overwriting of attributes with this change.

    @lisroach
    Copy link
    Contributor Author

    New changeset 9a7d951 by Lisa Roach in branch 'master':
    bpo-38108: Makes mock objects inherit from Base (GH-16060)
    9a7d951

    @lisroach
    Copy link
    Contributor Author

    New changeset b76ab35 by Lisa Roach (Miss Islington (bot)) in branch '3.8':
    bpo-38108: Makes mock objects inherit from Base (GH-16060) (GH-16470)
    b76ab35

    @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.8 only security fixes 3.9 only security fixes
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant