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

AsyncMock says it raises StopIteration but that is Impossible #83040

Closed
fried mannequin opened this issue Nov 20, 2019 · 2 comments
Closed

AsyncMock says it raises StopIteration but that is Impossible #83040

fried mannequin opened this issue Nov 20, 2019 · 2 comments
Labels
3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@fried
Copy link
Mannequin

fried mannequin commented Nov 20, 2019

BPO 38859
Nosy @fried, @lisroach, @tirkarthi
PRs
  • bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] #17269
  • 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 2019-11-21.18:16:58.519>
    created_at = <Date 2019-11-20.00:14:29.207>
    labels = ['3.8', 'type-bug', 'library', '3.9']
    title = 'AsyncMock says it raises StopIteration but that is Impossible'
    updated_at = <Date 2019-11-21.18:16:58.514>
    user = 'https://github.com/fried'

    bugs.python.org fields:

    activity = <Date 2019-11-21.18:16:58.514>
    actor = 'lisroach'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-11-21.18:16:58.519>
    closer = 'lisroach'
    components = ['Library (Lib)']
    creation = <Date 2019-11-20.00:14:29.207>
    creator = 'fried'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38859
    keywords = ['patch']
    message_count = 2.0
    messages = ['357008', '357191']
    nosy_count = 3.0
    nosy_names = ['fried', 'lisroach', 'xtreak']
    pr_nums = ['17269']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38859'
    versions = ['Python 3.8', 'Python 3.9']

    @fried
    Copy link
    Mannequin Author

    fried mannequin commented Nov 20, 2019

    If an AsyncMock uses a side_effect that is an Iterable, if called more than items exist its suppose to raise StopIteration according to the docs but PEP-479 says that is impossible.

    My Suggestion is that we update the docs and the code to Raise a StopAsyncIteration since it will not be converted to a RuntimeError

    @fried fried mannequin added 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 20, 2019
    @lisroach
    Copy link
    Contributor

    PR merged, thanks Jason!

    @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 stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant