pytest-dev / pytest-dev/pytest-mock

mocker.stub() is a coroutine function

Open
#375 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
2k
Forks
173
Avg merge
1d 10h
Merged PRs (30d)
6

Description

def test_icf_sync(mocker):
    func = mocker.stub('func')
    assert not inspect.iscoroutinefunction(func)


def test_icf_async(mocker):
    func = mocker.async_stub('func')
    assert inspect.iscoroutinefunction(func)

Expected: mocker.stub() returns something that doesn't resemble a coroutine.

Observed: mocker.stub() is detected as a coroutine.

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 running the two reproducer tests in the issue and inspect the implementations of mocker.stub() and mocker.async_stub(). Done means mocker.stub() is not detected as a coroutine function while mocker.async_stub() still is.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.