tests/conftest.py
def project_remote(request, tmp_path):
    """Project with a remote style (loaded from a URL)."""
    from tests.helpers import ProjectMock

    remote_url = "https://example.com/remote-style.toml"
    remote_style = """
        ["pyproject.toml".tool.black]
        line-length = 100
    """
    # https://docs.pytest.org/en/stable/fixture.html#using-markers-to-pass-data-to-fixtures
    marker = request.node.get_closest_marker("tool_nitpick")
    tool_nitpick = marker.args[0] if marker else ""

    with RequestsMock() as mocked_response:
        mocked_response.add(mocked_response.GET, remote_url, dedent(remote_style), status=200)

        project = ProjectMock(tmp_path)
        project.pyproject_toml(
            f"""
            [tool.nitpick]
            style = "{remote_url}"
            {tool_nitpick}

            [tool.black]
            line-length = 100
            """
        ).remote(mocked_response, remote_url)
        yield project
Project with a remote style (loaded from a URL).
Project with a remote style (loaded from a URL).
Project with a remote style ( loaded from a URL ) .
def project_remote(request, tmp_path):
    from tests.helpers import ProjectMock
    remote_url = "https://example.com/remote-style.toml"
    remote_style = """
        ["pyproject.toml".tool.black]
        line-length = 100
    """
    marker = request.node.get_closest_marker("tool_nitpick")
    tool_nitpick = marker.args[0] if marker else ""
    with RequestsMock() as mocked_response:
        mocked_response.add(mocked_response.GET, remote_url, dedent(remote_style), status=200)
        project = ProjectMock(tmp_path)
        project.pyproject_toml(
            f"""
            [tool.nitpick]
            style = "{remote_url}"
            {tool_nitpick}
            [tool.black]
            line-length = 100
            """
        ).remote(mocked_response, remote_url)
        yield project
def project_remote ( request , tmp_path ) : from tests . helpers import ProjectMock remote_url = "https://example.com/remote-style.toml" remote_style = """
        ["pyproject.toml".tool.black]
        line-length = 100
    """ marker = request . node . get_closest_marker ( "tool_nitpick" ) tool_nitpick = marker . args [ 0 ] if marker else "" with RequestsMock ( ) as mocked_response : mocked_response . add ( mocked_response . GET , remote_url , dedent ( remote_style ) , status = 200 ) project = ProjectMock ( tmp_path ) project . pyproject_toml ( f"""
            [tool.nitpick]
            style = "{remote_url}"
            {tool_nitpick}

            [tool.black]
            line-length = 100
            """ ) . remote ( mocked_response , remote_url ) yield project
Project with a remote style (loaded from a URL).
Project with a remote style ( loaded from a URL ) .
"""Project with a remote style (loaded from a URL).""" # https://docs.pytest.org/en/stable/fixture.html#using-markers-to-pass-data-to-fixtures
request
tmp_path