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

Alias _Call class? #71

Closed
blueyed opened this issue Nov 14, 2016 · 5 comments
Closed

Alias _Call class? #71

blueyed opened this issue Nov 14, 2016 · 5 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Nov 14, 2016

I am/was using code like the following to detect if some object is a _Call instance (to stop recursion in this case):

    from pytest_mock import mock_module

    try:
        _Call = mock_module.mock._Call
    except AttributeError:
        # unittest.mock
        _Call = mock_module._Call
    if isinstance(exp, _Call):
        ...

Since mock_module has been moved in a4cfee7, I wonder what is the best way to fix / address this.

@blueyed
Copy link
Contributor Author

blueyed commented Nov 21, 2016

As you can use mocker._mock_module (when the fixture is available), this is OK for me currently.

Feel free to re-open it, if you disagree.. :)

(Previously I was using this without using the mocker fixture, directly from the module - and currently that is not possible, since _get_mock_module also expects the pytest config by now).

@blueyed blueyed closed this as completed Nov 21, 2016
@nicoddemus
Copy link
Member

Oh sorry for not replying earlier @blueyed... this got lost on my list of items it seems.

I was wondering if we should just make mock_module public, through mocker.mock_module. I was not certain about this when I made that refactor, but now I don't see any downside of letting users use it.

What do you think?

@blueyed
Copy link
Contributor Author

blueyed commented Nov 21, 2016

Yep, makes sense! 👍

@blueyed
Copy link
Contributor Author

blueyed commented Nov 22, 2016

Should I do a PR, or will you handle it?

@nicoddemus
Copy link
Member

Don't worry, I will handle it tomorrow and make a quick release, but thanks for the offer!

nicoddemus added a commit to nicoddemus/pytest-mock that referenced this issue Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants