Remove tests not necessary anymore

This commit is contained in:
Laerte Pereira 2023-10-18 06:29:47 -03:00
parent 0956b76465
commit 38dbd43993
2 changed files with 0 additions and 109 deletions

View File

@ -371,15 +371,3 @@ class HttpCompressionTest(TestCase):
self.assertEqual(response.body, b"")
self.assertStatsEqual("httpcompression/response_count", None)
self.assertStatsEqual("httpcompression/response_bytes", None)
class HttpCompressionSubclassTest(TestCase):
def test_init_missing_stats(self):
class HttpCompressionMiddlewareSubclass(HttpCompressionMiddleware):
def __init__(self):
super().__init__()
crawler = get_crawler(Spider)
with self.assertRaises(TypeError):
HttpCompressionMiddlewareSubclass.from_crawler(crawler)

View File

@ -2835,103 +2835,6 @@ class FeedExportInitTest(unittest.TestCase):
self.assertIsInstance(exporter, FeedExporter)
class StdoutFeedStorageWithoutFeedOptions(StdoutFeedStorage):
def __init__(self, uri):
super().__init__(uri)
class StdoutFeedStoragePreFeedOptionsTest(unittest.TestCase):
"""Make sure that any feed exporter created by users before the
introduction of the ``feed_options`` parameter continues to work as
expected, and simply issues a warning."""
def test_init(self):
settings_dict = {
"FEED_URI": "file:///tmp/foobar",
"FEED_STORAGES": {"file": StdoutFeedStorageWithoutFeedOptions},
}
with pytest.raises(TypeError):
get_crawler(settings_dict=settings_dict)
class FileFeedStorageWithoutFeedOptions(FileFeedStorage):
def __init__(self, uri):
super().__init__(uri)
class FileFeedStoragePreFeedOptionsTest(unittest.TestCase):
maxDiff = None
def test_init(self):
with tempfile.NamedTemporaryFile() as temp:
settings_dict = {
"FEED_URI": f"file:///{temp.name}",
"FEED_STORAGES": {"file": FileFeedStorageWithoutFeedOptions},
}
with self.assertRaises(TypeError):
get_crawler(settings_dict=settings_dict)
class S3FeedStorageWithoutFeedOptions(S3FeedStorage):
def __init__(self, uri, access_key, secret_key, acl, endpoint_url, **kwargs):
super().__init__(uri, access_key, secret_key, acl, endpoint_url, **kwargs)
class S3FeedStorageWithoutFeedOptionsWithFromCrawler(S3FeedStorage):
@classmethod
def from_crawler(cls, crawler, uri):
return super().from_crawler(crawler, uri)
class S3FeedStoragePreFeedOptionsTest(unittest.TestCase):
maxDiff = None
def setUp(self):
skip_if_no_boto()
def test_init(self):
settings_dict = {
"FEED_URI": "file:///tmp/foobar",
"FEED_STORAGES": {"file": S3FeedStorageWithoutFeedOptions},
}
with pytest.warns(
ScrapyDeprecationWarning,
match="The `FEED_URI` and `FEED_FORMAT` settings have been deprecated",
):
crawler = get_crawler(settings_dict=settings_dict)
feed_exporter = FeedExporter.from_crawler(crawler)
spider = scrapy.Spider("default")
spider.crawler = crawler
feed_exporter.open_spider(spider)
def test_from_crawler(self):
settings_dict = {
"FEED_URI": "file:///tmp/foobar",
"FEED_STORAGES": {"file": S3FeedStorageWithoutFeedOptionsWithFromCrawler},
}
with pytest.raises(TypeError):
get_crawler(settings_dict=settings_dict)
class FTPFeedStorageWithoutFeedOptions(FTPFeedStorage):
def __init__(self, uri, use_active_mode=False):
super().__init__(uri)
class FTPFeedStoragePreFeedOptionsTest(unittest.TestCase):
maxDiff = None
def test_init(self):
settings_dict = {
"FEED_URI": "ftp://localhost/foo",
"FEED_STORAGES": {"ftp": FTPFeedStorageWithoutFeedOptions},
}
with pytest.raises(TypeError):
get_crawler(settings_dict=settings_dict)
class URIParamsTest:
spider_name = "uri_params_spider"
deprecated_options = False