Skip to content

Commit

Permalink
Moved warnings.filterwarnings() call into deprecation module. Removed…
Browse files Browse the repository at this point in the history
… warnings.simplefilter(“always”) from tests (should hopefully fix the failing Python 3.7 tests on Travic CI)
  • Loading branch information
heyman committed Oct 23, 2019
1 parent 303c35a commit e5e17b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion locust/core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import random
import sys
import warnings
import traceback
from time import time

Expand Down
4 changes: 0 additions & 4 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
import time
import argparse
import warnings

import gevent

Expand All @@ -25,9 +24,6 @@
_internals = [Locust, HttpLocust]
version = locust.__version__

# Show deprecation warnings
warnings.filterwarnings('always', category=DeprecationWarning, module="locust")


def parse_options():
"""
Expand Down
5 changes: 0 additions & 5 deletions locust/test/test_old_wait_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions locust/util/deprecation.py
Original file line number Diff line number Diff line change
@@ -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__
Expand Down

0 comments on commit e5e17b2

Please sign in to comment.