Skip to content

Add all the necessary imports in the code examples in the doc #204

@joaompinto

Description

@joaompinto

In some snippets the documentation provides the import statement for requests but not for the HTTPServer object, adding all the required imports should make the documentation more clear and easier to use specially for new users.

Example:
Current:

import requests


def test_json_client(httpserver: HTTPServer):
    httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
    assert requests.get(httpserver.url_for("/foobar")).json() == {"foo": "bar"}

Proposed:

import requests
from pytest_httpserver import HTTPServer

def test_json_client(httpserver: HTTPServer):
    httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
    assert requests.get(httpserver.url_for("/foobar")).json() == {"foo": "bar"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions