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

module 'respx' has no attribute 'pop' #70

Closed
paulineribeyre opened this issue Aug 27, 2020 · 2 comments · Fixed by #72
Closed

module 'respx' has no attribute 'pop' #70

paulineribeyre opened this issue Aug 27, 2020 · 2 comments · Fixed by #72
Labels
bug Something isn't working

Comments

@paulineribeyre
Copy link
Contributor

Hello- I am trying to use the pop method as described in the docs (#60), but running into the issue below. As you can see I am using the latest version, which should include pop:

    @respx.mock
    def test_something():
        import pkg_resources
        assert pkg_resources.get_distribution('respx').version == "0.12.1"
    
        respx.get("https://foo.bar/", status_code=404, alias="index")
>       request_pattern = respx.pop("index")
E       AttributeError: module 'respx' has no attribute 'pop'

Is there something I'm doing wrong?

@lundberg
Copy link
Owner

Nope, you're right....seems like the global API is missing pop, i.e. docs is incorrect.

The pop feature introduced in #60 is currently only available through a mock transport instance...

@respx.mock()
def test_something(respx_mock):
    ...
    respx_mock.pop("index")

It's an easy fix to expose it globally in api.py, thanks for finding and reporting the issue!

@lundberg lundberg added the bug Something isn't working label Aug 28, 2020
@paulineribeyre
Copy link
Contributor Author

@lundberg thanks for having a look, I made a PR to fix this: #72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants