diff --git a/locust/core.py b/locust/core.py index d0278706a5..da5eb3c7be 100644 --- a/locust/core.py +++ b/locust/core.py @@ -1,7 +1,6 @@ import logging import random import sys -import warnings import traceback from time import time diff --git a/locust/main.py b/locust/main.py index 99fa0d1bdb..2f53fb8a45 100644 --- a/locust/main.py +++ b/locust/main.py @@ -7,7 +7,6 @@ import sys import time import argparse -import warnings import gevent @@ -25,9 +24,6 @@ _internals = [Locust, HttpLocust] version = locust.__version__ -# Show deprecation warnings -warnings.filterwarnings('always', category=DeprecationWarning, module="locust") - def parse_options(): """ diff --git a/locust/test/test_old_wait_api.py b/locust/test/test_old_wait_api.py index 9eaeb07bdc..96d32f2b32 100644 --- a/locust/test/test_old_wait_api.py +++ b/locust/test/test_old_wait_api.py @@ -15,7 +15,6 @@ def setUp(self): def test_wait_function(self): with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") class User(Locust): wait_function = lambda self: 5000 class MyTaskSet(TaskSet): @@ -28,7 +27,6 @@ class MyTaskSet(TaskSet): def test_wait_function_on_taskset(self): with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") class User(Locust): pass class MyTaskSet(TaskSet): @@ -41,7 +39,6 @@ class MyTaskSet(TaskSet): def test_min_max_wait(self): with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") class User(Locust): min_wait = 1000 max_wait = 1000 @@ -58,7 +55,6 @@ def t(self): def test_min_max_wait_combined_with_wait_time(self): with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") class User(Locust): min_wait = 1000 max_wait = 1000 @@ -76,7 +72,6 @@ def t(self): def test_min_max_wait_on_taskset(self): with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") class User(Locust): wait_time = constant(3) class TS(TaskSet): diff --git a/locust/util/deprecation.py b/locust/util/deprecation.py index 039e512ab0..fc8a9163a6 100644 --- a/locust/util/deprecation.py +++ b/locust/util/deprecation.py @@ -1,6 +1,11 @@ import six import warnings + +# Show deprecation warnings +warnings.filterwarnings('always', category=DeprecationWarning, module="locust") + + def get_class_func(f): if six.PY2: return f.__func__