Skip to content

Commit

Permalink
Solve test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Feb 14, 2024
1 parent 502addc commit 2f1d345
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions tests/test_downloadermiddleware_httpcompression.py
Expand Up @@ -402,6 +402,10 @@ def test_compression_bomb_setting_gzip(self):
self._test_compression_bomb_setting("gzip")

def test_compression_bomb_setting_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_compression_bomb_setting("zstd")

def _test_compression_bomb_spider_attr(self, compression_id):
Expand Down Expand Up @@ -436,6 +440,10 @@ def test_compression_bomb_spider_attr_gzip(self):
self._test_compression_bomb_spider_attr("gzip")

def test_compression_bomb_spider_attr_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_compression_bomb_spider_attr("zstd")

def _test_compression_bomb_request_meta(self, compression_id):
Expand Down Expand Up @@ -468,6 +476,10 @@ def test_compression_bomb_request_meta_gzip(self):
self._test_compression_bomb_request_meta("gzip")

def test_compression_bomb_request_meta_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_compression_bomb_request_meta("zstd")

def _test_download_warnsize_setting(self, compression_id):
Expand Down Expand Up @@ -510,6 +522,10 @@ def test_download_warnsize_setting_gzip(self):
self._test_download_warnsize_setting("gzip")

def test_download_warnsize_setting_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_download_warnsize_setting("zstd")

def _test_download_warnsize_spider_attr(self, compression_id):
Expand Down Expand Up @@ -554,6 +570,10 @@ def test_download_warnsize_spider_attr_gzip(self):
self._test_download_warnsize_spider_attr("gzip")

def test_download_warnsize_spider_attr_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_download_warnsize_spider_attr("zstd")

def _test_download_warnsize_request_meta(self, compression_id):
Expand Down Expand Up @@ -596,6 +616,10 @@ def test_download_warnsize_request_meta_gzip(self):
self._test_download_warnsize_request_meta("gzip")

def test_download_warnsize_request_meta_zstd(self):
try:
import zstandard # noqa: F401
except ImportError:
raise SkipTest("no zstd support (zstandard)")
self._test_download_warnsize_request_meta("zstd")


Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils_response.py
Expand Up @@ -204,7 +204,7 @@ def check_base_url(burl):
), "Inject unique base url with conditional comment"

def test_open_in_browser_redos_comment(self):
MAX_CPU_TIME = 0.001
MAX_CPU_TIME = 0.02

# Exploit input from
# https://makenowjust-labs.github.io/recheck/playground/
Expand All @@ -221,7 +221,7 @@ def test_open_in_browser_redos_comment(self):
self.assertLess(end_time - start_time, MAX_CPU_TIME)

def test_open_in_browser_redos_head(self):
MAX_CPU_TIME = 0.001
MAX_CPU_TIME = 0.02

# Exploit input from
# https://makenowjust-labs.github.io/recheck/playground/
Expand Down

0 comments on commit 2f1d345

Please sign in to comment.