squash
This commit is contained in:
parent
33ee4c21b3
commit
d18a776964
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
@ -22,7 +23,9 @@ class SanicArgumentParser(ArgumentParser):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = SanicArgumentParser(
|
parser = SanicArgumentParser(
|
||||||
prog="sanic", description=BASE_LOGO, formatter_class=RawDescriptionHelpFormatter
|
prog="sanic",
|
||||||
|
description=BASE_LOGO,
|
||||||
|
formatter_class=RawDescriptionHelpFormatter,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-H",
|
"-H",
|
||||||
|
@ -67,7 +70,10 @@ def main():
|
||||||
"--access-logs", dest="access_log", help="display access logs"
|
"--access-logs", dest="access_log", help="display access logs"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v", "--version", action="version", version=f"Sanic {__version__}",
|
"-v",
|
||||||
|
"--version",
|
||||||
|
action="version",
|
||||||
|
version=f"Sanic {__version__}",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"module", help="path to your Sanic app. Example: path.to.server:app"
|
"module", help="path to your Sanic app. Example: path.to.server:app"
|
||||||
|
|
|
@ -735,6 +735,7 @@ def test_static_blueprint_name(app: Sanic, static_file_directory, file_name):
|
||||||
_, response = app.test_client.get("/static/test.file/")
|
_, response = app.test_client.get("/static/test.file/")
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("file_name", ["test.file"])
|
@pytest.mark.parametrize("file_name", ["test.file"])
|
||||||
def test_static_blueprintp_mw(app: Sanic, static_file_directory, file_name):
|
def test_static_blueprintp_mw(app: Sanic, static_file_directory, file_name):
|
||||||
current_file = inspect.getfile(inspect.currentframe())
|
current_file = inspect.getfile(inspect.currentframe())
|
||||||
|
@ -745,7 +746,7 @@ def test_static_blueprintp_mw(app: Sanic, static_file_directory, file_name):
|
||||||
|
|
||||||
bp = Blueprint(name="test_mw", url_prefix="")
|
bp = Blueprint(name="test_mw", url_prefix="")
|
||||||
|
|
||||||
@bp.middleware('request')
|
@bp.middleware("request")
|
||||||
def bp_mw1(request):
|
def bp_mw1(request):
|
||||||
nonlocal triggered
|
nonlocal triggered
|
||||||
triggered = True
|
triggered = True
|
||||||
|
@ -754,7 +755,7 @@ def test_static_blueprintp_mw(app: Sanic, static_file_directory, file_name):
|
||||||
"/test.file",
|
"/test.file",
|
||||||
get_file_path(static_file_directory, file_name),
|
get_file_path(static_file_directory, file_name),
|
||||||
strict_slashes=True,
|
strict_slashes=True,
|
||||||
name="static"
|
name="static",
|
||||||
)
|
)
|
||||||
|
|
||||||
app.blueprint(bp)
|
app.blueprint(bp)
|
||||||
|
|
|
@ -20,7 +20,9 @@ def test_load_module_from_file_location(loaded_module_from_file_location):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.dependency(depends=["test_load_module_from_file_location"])
|
@pytest.mark.dependency(depends=["test_load_module_from_file_location"])
|
||||||
def test_loaded_module_from_file_location_name(loaded_module_from_file_location,):
|
def test_loaded_module_from_file_location_name(
|
||||||
|
loaded_module_from_file_location,
|
||||||
|
):
|
||||||
name = loaded_module_from_file_location.__name__
|
name = loaded_module_from_file_location.__name__
|
||||||
if "C:\\" in name:
|
if "C:\\" in name:
|
||||||
name = name.split("\\")[-1]
|
name = name.split("\\")[-1]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user