Skip to content

Commit

Permalink
Remove slow_test pytest marker (#120)
Browse files Browse the repository at this point in the history
* explicit register slow_test pytest mark to get rid of pytest warning

* import pytest instead of pytest.mark

* removed slow_test marker

* removed unused pytest import
  • Loading branch information
janusheide authored Feb 20, 2024
1 parent c989535 commit a0cdfd1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
4 changes: 0 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ def test(ctx, all=False):
'--timeout=30' # Each test should timeout after 30 sec
]

# Default to not running the slow tests.
if not all:
test_cmd.append('-m "not slow_test"')

# Test in this directory
test_cmd.append("tests")

Expand Down
23 changes: 0 additions & 23 deletions tests/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,6 @@ def _samefile(x, y):
sys.path.insert(0, path)


# Check if pytest is imported. If so, we use it to create marking decorators.
# If not, we just create a function that does nothing.
try:
import pytest
except ImportError:
pytest = None

if pytest is not None:
slow_test = pytest.mark.slow_test
xfail = pytest.mark.xfail

else:

def slow_test(x):
return x

def xfail(*args, **kwargs):
if len(args) > 0 and isinstance(args[0], types.FunctionType):
return args[0]

return lambda x: x


# We don't use the pytest parametrizing function, since it seems to break
# with unittest.TestCase subclasses.
def parametrize(field_names, field_values):
Expand Down
4 changes: 1 addition & 3 deletions tests/test_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
parse_options_header,
)

from .compat import parametrize, parametrize_class, slow_test
from .compat import parametrize, parametrize_class

if TYPE_CHECKING:
from multipart.multipart import FileConfig
Expand Down Expand Up @@ -905,7 +905,6 @@ def test_feed_blocks(self):
# Assert that our field is here.
self.assert_field(b"field", b"0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ")

@slow_test
def test_request_body_fuzz(self):
"""
This test randomly fuzzes the request body to ensure that no strange
Expand Down Expand Up @@ -978,7 +977,6 @@ def test_request_body_fuzz(self):
print("Failures: %d" % (failures,))
print("Exceptions: %d" % (exceptions,))

@slow_test
def test_request_body_fuzz_random_data(self):
"""
This test will fuzz the multipart parser with some number of iterations
Expand Down

0 comments on commit a0cdfd1

Please sign in to comment.