forked from orbit-oss/flask
fix flake8 bugbear errors
This commit is contained in:
parent
8f13f5b6d6
commit
261e4a6cf2
3 changed files with 17 additions and 16 deletions
23
.flake8
23
.flake8
|
|
@ -1,12 +1,12 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
# B = bugbear
|
extend-select =
|
||||||
# E = pycodestyle errors
|
# bugbear
|
||||||
# F = flake8 pyflakes
|
B
|
||||||
# W = pycodestyle warnings
|
# bugbear opinions
|
||||||
# B9 = bugbear opinions
|
B9
|
||||||
# ISC = implicit str concat
|
# implicit str concat
|
||||||
select = B, E, F, W, B9, ISC
|
ISC
|
||||||
ignore =
|
extend-ignore =
|
||||||
# slice notation whitespace, invalid
|
# slice notation whitespace, invalid
|
||||||
E203
|
E203
|
||||||
# import at top, too many circular import fixes
|
# import at top, too many circular import fixes
|
||||||
|
|
@ -15,10 +15,11 @@ ignore =
|
||||||
E501
|
E501
|
||||||
# bare except, handled by bugbear B001
|
# bare except, handled by bugbear B001
|
||||||
E722
|
E722
|
||||||
# bin op line break, invalid
|
# zip with strict=, requires python >= 3.10
|
||||||
W503
|
|
||||||
# requires Python 3.10
|
|
||||||
B905
|
B905
|
||||||
|
# string formatting opinion, B028 renamed to B907
|
||||||
|
B028
|
||||||
|
B907
|
||||||
# up to 88 allowed by bugbear B950
|
# up to 88 allowed by bugbear B950
|
||||||
max-line-length = 80
|
max-line-length = 80
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
|
|
|
||||||
|
|
@ -120,14 +120,14 @@ def test_app_tearing_down_with_unhandled_exception(app, client):
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
raise Exception("dummy")
|
raise ValueError("dummy")
|
||||||
|
|
||||||
with pytest.raises(Exception, match="dummy"):
|
with pytest.raises(ValueError, match="dummy"):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
client.get("/")
|
client.get("/")
|
||||||
|
|
||||||
assert len(cleanup_stuff) == 1
|
assert len(cleanup_stuff) == 1
|
||||||
assert isinstance(cleanup_stuff[0], Exception)
|
assert isinstance(cleanup_stuff[0], ValueError)
|
||||||
assert str(cleanup_stuff[0]) == "dummy"
|
assert str(cleanup_stuff[0]) == "dummy"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1472,11 +1472,11 @@ def test_static_route_with_host_matching():
|
||||||
rv = flask.url_for("static", filename="index.html", _external=True)
|
rv = flask.url_for("static", filename="index.html", _external=True)
|
||||||
assert rv == "http://example.com/static/index.html"
|
assert rv == "http://example.com/static/index.html"
|
||||||
# Providing static_host without host_matching=True should error.
|
# Providing static_host without host_matching=True should error.
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(AssertionError):
|
||||||
flask.Flask(__name__, static_host="example.com")
|
flask.Flask(__name__, static_host="example.com")
|
||||||
# Providing host_matching=True with static_folder
|
# Providing host_matching=True with static_folder
|
||||||
# but without static_host should error.
|
# but without static_host should error.
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(AssertionError):
|
||||||
flask.Flask(__name__, host_matching=True)
|
flask.Flask(__name__, host_matching=True)
|
||||||
# Providing host_matching=True without static_host
|
# Providing host_matching=True without static_host
|
||||||
# but with static_folder=None should not error.
|
# but with static_folder=None should not error.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue