python / python/cpython

MagicMock __aenter__ should be AsyncMock(return_value=MagicMock())

Open
#84,586 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.8 (EOL) 3.9 (EOL) tests type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

BPO 40406
Nosy @briancurtin, @asvetlov, @1st1, @graingert, @lisroach, @tirkarthi

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 = None
created_at = <Date 2020-04-27.13:33:28.877>
labels = ['3.8', 'type-bug', 'tests', '3.9', 'expert-asyncio']
title = 'MagicMock __aenter__ should be AsyncMock(return_value=MagicMock())'
updated_at = <Date 2020-12-07.23:23:01.700>
user = 'https://github.com/graingert'

bugs.python.org fields:

activity = <Date 2020-12-07.23:23:01.700>
actor = 'simon.d.beal'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests', 'asyncio']
creation = <Date 2020-04-27.13:33:28.877>
creator = 'graingert'
dependencies = []
files = []
hgrepos = []
issue_num = 40406
keywords = []
message_count = 4.0
messages = ['367419', '367420', '367903', '367913']
nosy_count = 7.0
nosy_names = ['brian.curtin', 'asvetlov', 'yselivanov', 'graingert', 'lisroach', 'xtreak', 'simon.d.beal']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue40406'
versions = ['Python 3.8', 'Python 3.9']

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating MagicMock's asynchronous context-manager handling and the existing tests for asyncio mocks. Verify the current aenter behavior, then update the relevant behavior so it is an AsyncMock returning a MagicMock and add coverage demonstrating that result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.