diff --git a/tests/performance/bottle/simple_server.py b/tests/performance/bottle/simple_server.py index 43a8f019..97846572 100644 --- a/tests/performance/bottle/simple_server.py +++ b/tests/performance/bottle/simple_server.py @@ -2,7 +2,7 @@ import bottle import ujson -from bottle import route, run +from bottle import route @route("/") diff --git a/tests/performance/sanic/http_response.py b/tests/performance/sanic/http_response.py index 52596e5e..2e32b620 100644 --- a/tests/performance/sanic/http_response.py +++ b/tests/performance/sanic/http_response.py @@ -3,7 +3,6 @@ import os import sys import timeit -import asyncpg from sanic.response import json diff --git a/tests/performance/wheezy/simple_server.py b/tests/performance/wheezy/simple_server.py index f5db80b4..7b6f3385 100644 --- a/tests/performance/wheezy/simple_server.py +++ b/tests/performance/wheezy/simple_server.py @@ -4,7 +4,6 @@ import ujson from wheezy.http import HTTPResponse, WSGIApplication -from wheezy.http.response import json_response from wheezy.routing import url from wheezy.web.handlers import BaseHandler from wheezy.web.middleware import ( diff --git a/tests/test_asgi.py b/tests/test_asgi.py index 8fce84af..f5de8fdc 100644 --- a/tests/test_asgi.py +++ b/tests/test_asgi.py @@ -1,4 +1,3 @@ -import asyncio import logging from collections import deque, namedtuple @@ -12,7 +11,7 @@ from pytest import MonkeyPatch from sanic import Sanic from sanic.application.state import Mode -from sanic.asgi import ASGIApp, Lifespan, MockTransport +from sanic.asgi import Lifespan, MockTransport from sanic.exceptions import BadRequest, Forbidden, ServiceUnavailable from sanic.request import Request from sanic.response import json, text diff --git a/tests/test_cancellederror.py b/tests/test_cancellederror.py index b61fd596..7c741065 100644 --- a/tests/test_cancellederror.py +++ b/tests/test_cancellederror.py @@ -1,8 +1,6 @@ -import asyncio from asyncio import CancelledError -import pytest from sanic import Request, Sanic, json diff --git a/tests/test_exceptions_handler.py b/tests/test_exceptions_handler.py index 9c211287..7697162e 100644 --- a/tests/test_exceptions_handler.py +++ b/tests/test_exceptions_handler.py @@ -7,7 +7,7 @@ from unittest.mock import Mock import pytest from bs4 import BeautifulSoup -from pytest import LogCaptureFixture, MonkeyPatch, WarningsRecorder +from pytest import LogCaptureFixture, MonkeyPatch from sanic import Sanic, handlers from sanic.exceptions import BadRequest, Forbidden, NotFound, ServerError diff --git a/tests/test_ext_integration.py b/tests/test_ext_integration.py index 228d7624..abec0f59 100644 --- a/tests/test_ext_integration.py +++ b/tests/test_ext_integration.py @@ -1,6 +1,5 @@ import sys -from unittest.mock import MagicMock import pytest diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py index 6e5569d1..98e19073 100644 --- a/tests/test_multiprocessing.py +++ b/tests/test_multiprocessing.py @@ -14,7 +14,6 @@ from sanic_testing.testing import HOST, PORT from sanic import Blueprint, text from sanic.compat import use_context from sanic.log import logger -from sanic.server.socket import configure_socket @pytest.mark.skipif( diff --git a/tests/test_request_stream.py b/tests/test_request_stream.py index 1513f878..1c21229d 100644 --- a/tests/test_request_stream.py +++ b/tests/test_request_stream.py @@ -573,7 +573,7 @@ def test_streaming_echo(): async def client(app, reader, writer): # Unfortunately httpx does not support 2-way streaming, so do it by hand. - host = f"host: localhost:8000\r\n".encode() + host = "host: localhost:8000\r\n".encode() writer.write( b"POST /echo HTTP/1.1\r\n" + host + b"content-length: 2\r\n" b"content-type: text/plain; charset=utf-8\r\n" @@ -581,7 +581,7 @@ def test_streaming_echo(): ) # Read response res = b"" - while not b"\r\n\r\n" in res: + while b"\r\n\r\n" not in res: res += await reader.read(4096) assert res.startswith(b"HTTP/1.1 200 OK\r\n") assert res.endswith(b"\r\n\r\n") @@ -589,7 +589,7 @@ def test_streaming_echo(): async def read_chunk(): nonlocal buffer - while not b"\r\n" in buffer: + while b"\r\n" not in buffer: data = await reader.read(4096) assert data buffer += data diff --git a/tests/test_requests.py b/tests/test_requests.py index 6719025b..d68b2dff 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -2011,11 +2011,11 @@ def test_server_name_and_url_for(app): app.config.SERVER_NAME = "my-server" # This means default port assert app.url_for("handler", _external=True) == "http://my-server/foo" request, response = app.test_client.get("/foo") - assert request.url_for("handler") == f"http://my-server/foo" + assert request.url_for("handler") == "http://my-server/foo" app.config.SERVER_NAME = "https://my-server/path" request, response = app.test_client.get("/foo") - url = f"https://my-server/path/foo" + url = "https://my-server/path/foo" assert app.url_for("handler", _external=True) == url assert request.url_for("handler") == url diff --git a/tests/test_response.py b/tests/test_response.py index db3036ea..a158de57 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -769,7 +769,7 @@ def test_file_response_headers( assert ( "cache-control" in headers and f"max-age={test_max_age}" in headers.get("cache-control") - and f"public" in headers.get("cache-control") + and "public" in headers.get("cache-control") ) assert ( "expires" in headers @@ -800,14 +800,14 @@ def test_file_response_headers( _, response = app.test_client.get(f"/files/no_cache/{file_name}") headers = response.headers - assert "cache-control" in headers and f"no-cache" == headers.get( + assert "cache-control" in headers and "no-cache" == headers.get( "cache-control" ) assert response.status == 200 _, response = app.test_client.get(f"/files/no_store/{file_name}") headers = response.headers - assert "cache-control" in headers and f"no-store" == headers.get( + assert "cache-control" in headers and "no-store" == headers.get( "cache-control" ) assert response.status == 200 diff --git a/tests/typing/test_typing.py b/tests/typing/test_typing.py index 5ebba266..bdb7bf56 100644 --- a/tests/typing/test_typing.py +++ b/tests/typing/test_typing.py @@ -1,7 +1,6 @@ # flake8: noqa: E501 import subprocess -import sys from pathlib import Path from typing import List, Tuple