Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Flask 2.2.0 breaking changes #2148

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions locust/test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ def create_tls_cert(hostname):


def clear_all_functools_lru_cache() -> None:
# Somehow, the code below throws unrelated DeprecationWarning related to Flask.
# We mute the warnings in order to not pollute the logs when running the tests.
with warnings.catch_warnings(record=True):
# Clear all `functools.lru_cache` to ensure that no state are persisted from one test to another.
# Taken from https://stackoverflow.com/a/50699209.
gc.collect()
wrappers = [a for a in gc.get_objects() if isinstance(a, functools._lru_cache_wrapper)]
assert len(wrappers) > 0
for wrapper in wrappers:
wrapper.cache_clear()
# Clear all `functools.lru_cache` to ensure that no state are persisted from one test to another.
# Taken from https://stackoverflow.com/a/50699209.
gc.collect()
wrappers = [a for a in gc.get_objects() if isinstance(a, functools._lru_cache_wrapper)]
assert len(wrappers) > 0
for wrapper in wrappers:
wrapper.cache_clear()
1 change: 0 additions & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def request_stats_full_history_csv() -> Response:
as_attachment=True,
download_name=_download_csv_suggest_file_name("requests_full_history"),
etag=True,
cache_timeout=None,
conditional=True,
last_modified=None,
)
Expand Down