pylint issues resolved
Ran tests, and black afterwards. Updated changes.rst and included pre-commit hooks as required. Ran isort on imports.
This commit is contained in:
parent
3dc6db9d0c
commit
dde76ea960
32 changed files with 114 additions and 132 deletions
|
|
@ -95,7 +95,7 @@ def leak_detector():
|
|||
leaks.append(request_ctx._get_current_object())
|
||||
request_ctx.pop()
|
||||
|
||||
assert leaks == []
|
||||
assert not leaks
|
||||
|
||||
|
||||
@pytest.fixture(params=(True, False))
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
from blueprintapp.apps.admin import admin
|
||||
from blueprintapp.apps.frontend import frontend
|
||||
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config["DEBUG"] = True
|
||||
from blueprintapp.apps.admin import admin
|
||||
from blueprintapp.apps.frontend import frontend
|
||||
|
||||
|
||||
app.register_blueprint(admin)
|
||||
app.register_blueprint(frontend)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from flask import Module
|
||||
|
||||
|
||||
mod = Module(__name__, "foo", subdomain="foo")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ from werkzeug.routing import RequestRedirect
|
|||
|
||||
import flask
|
||||
|
||||
|
||||
require_cpython_gc = pytest.mark.skipif(
|
||||
python_implementation() != "CPython",
|
||||
reason="Requires CPython GC behavior",
|
||||
|
|
@ -191,7 +190,7 @@ def test_url_mapping(app, client):
|
|||
|
||||
|
||||
def test_werkzeug_routing(app, client):
|
||||
from werkzeug.routing import Submount, Rule
|
||||
from werkzeug.routing import Rule, Submount
|
||||
|
||||
app.url_map.add(
|
||||
Submount("/foo", [Rule("/bar", endpoint="bar"), Rule("/", endpoint="index")])
|
||||
|
|
@ -211,7 +210,7 @@ def test_werkzeug_routing(app, client):
|
|||
|
||||
|
||||
def test_endpoint_decorator(app, client):
|
||||
from werkzeug.routing import Submount, Rule
|
||||
from werkzeug.routing import Rule, Submount
|
||||
|
||||
app.url_map.add(
|
||||
Submount("/foo", [Rule("/bar", endpoint="bar"), Rule("/", endpoint="index")])
|
||||
|
|
@ -486,9 +485,9 @@ def test_session_special_types(app, client):
|
|||
client.get("/")
|
||||
s = flask.session
|
||||
assert s["t"] == (1, 2, 3)
|
||||
assert type(s["b"]) == bytes
|
||||
assert isinstance(s["b"], bytes)
|
||||
assert s["b"] == b"\xff"
|
||||
assert type(s["m"]) == flask.Markup
|
||||
assert isinstance(s["m"], flask.Markup)
|
||||
assert s["m"] == flask.Markup("<html>")
|
||||
assert s["u"] == the_uuid
|
||||
assert s["d"] == now
|
||||
|
|
@ -792,7 +791,7 @@ def test_teardown_request_handler_error(app, client):
|
|||
|
||||
@app.teardown_request
|
||||
def teardown_request1(exc):
|
||||
assert type(exc) == ZeroDivisionError
|
||||
assert isinstance(exc, ZeroDivisionError)
|
||||
called.append(True)
|
||||
# This raises a new error and blows away sys.exc_info(), so we can
|
||||
# test that all teardown_requests get passed the same original
|
||||
|
|
@ -804,7 +803,7 @@ def test_teardown_request_handler_error(app, client):
|
|||
|
||||
@app.teardown_request
|
||||
def teardown_request2(exc):
|
||||
assert type(exc) == ZeroDivisionError
|
||||
assert isinstance(exc, ZeroDivisionError)
|
||||
called.append(True)
|
||||
# This raises a new error and blows away sys.exc_info(), so we can
|
||||
# test that all teardown_requests get passed the same original
|
||||
|
|
@ -1631,7 +1630,7 @@ def test_inject_blueprint_url_defaults(app):
|
|||
|
||||
app.register_blueprint(bp)
|
||||
|
||||
values = dict()
|
||||
values = {}
|
||||
app.inject_url_defaults("foo.view", values)
|
||||
expected = dict(page="login")
|
||||
assert values == expected
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ def test_request_processing(app, client):
|
|||
|
||||
app.register_blueprint(bp)
|
||||
|
||||
assert evts == []
|
||||
assert not evts
|
||||
rv = client.get("/bp")
|
||||
assert rv.data == b"request|after"
|
||||
assert evts == ["before", "after", "teardown"]
|
||||
|
|
@ -750,7 +750,7 @@ def test_app_request_processing(app, client):
|
|||
return "request"
|
||||
|
||||
# before first request
|
||||
assert evts == []
|
||||
assert not evts
|
||||
|
||||
# first request
|
||||
resp = client.get("/").data
|
||||
|
|
|
|||
|
|
@ -227,10 +227,12 @@ def test_locate_app_suppress_raise(test_apps):
|
|||
|
||||
|
||||
def test_get_version(test_apps, capsys):
|
||||
from flask import __version__ as flask_version
|
||||
from werkzeug import __version__ as werkzeug_version
|
||||
from platform import python_version
|
||||
|
||||
from werkzeug import __version__ as werkzeug_version
|
||||
|
||||
from flask import __version__ as flask_version
|
||||
|
||||
class MockCtx:
|
||||
resilient_parsing = False
|
||||
color = None
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import pytest
|
|||
|
||||
import flask
|
||||
|
||||
|
||||
# config keys used for the TestConfig
|
||||
TEST_KEY = "foo"
|
||||
SECRET_KEY = "config"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ def test_teardown_on_pop(app):
|
|||
|
||||
ctx = app.test_request_context()
|
||||
ctx.push()
|
||||
assert buffer == []
|
||||
assert not buffer
|
||||
ctx.pop()
|
||||
assert buffer == [None]
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ def test_teardown_with_previous_exception(app):
|
|||
pass
|
||||
|
||||
with app.test_request_context():
|
||||
assert buffer == []
|
||||
assert not buffer
|
||||
assert buffer == [None]
|
||||
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ def test_teardown_with_handled_exception(app):
|
|||
buffer.append(exception)
|
||||
|
||||
with app.test_request_context():
|
||||
assert buffer == []
|
||||
assert not buffer
|
||||
try:
|
||||
raise Exception("dummy")
|
||||
except Exception:
|
||||
|
|
@ -234,8 +234,7 @@ def test_session_dynamic_cookie_name():
|
|||
def get_cookie_name(self, app):
|
||||
if flask.request.url.endswith("dynamic_cookie"):
|
||||
return "dynamic_cookie_name"
|
||||
else:
|
||||
return super().get_cookie_name(app)
|
||||
return super().get_cookie_name(app)
|
||||
|
||||
class CustomFlask(flask.Flask):
|
||||
session_interface = PathAwareSessionInterface()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue