Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

[test_downloadermiddleware_httpcache] Fixing pytest skip behaviour https://github.com/scrapy/scrapy/issues/4085

Royc51fb959e298
diff --git a/tests/test_downloadermiddleware_httpcache.py b/tests/test_downloadermiddleware_httpcache.py
index 32085b095..047526569 100644
--- a/tests/test_downloadermiddleware_httpcache.py
+++ b/tests/test_downloadermiddleware_httpcache.py
@@ -6,6 +6,7 @@ import unittest
import email.utils
from contextlib import contextmanager
import pytest
+import sys
from scrapy.http import Response, HtmlResponse, Request
from scrapy.spiders import Spider
@@ -160,7 +161,7 @@ class LeveldbStorageTest(DefaultStorageTest):
pytest.importorskip('leveldb')
except SystemError:
# Happens in python 3.8
- pytest.skip("'SystemError: bad call flags' occurs on Python 3.8")
+ pytestmark = pytest.skip("'SystemError: bad call flags' occurs on Python 3.8")
storage_class = 'scrapy.extensions.httpcache.LeveldbCacheStorage'