repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_extension_periodic_log.py
tests/test_extension_periodic_log.py
from __future__ import annotations import datetime from typing import TYPE_CHECKING, Any from scrapy.extensions.periodic_log import PeriodicLog from scrapy.utils.test import get_crawler from .spiders import MetaSpider if TYPE_CHECKING: from collections.abc import Callable stats_dump_1 = { "log_count/INFO"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_downloader_handlers.py
tests/test_downloader_handlers.py
"""Tests for DownloadHandlers and for specific non-HTTP download handlers.""" from __future__ import annotations import contextlib import os from pathlib import Path from tempfile import mkdtemp, mkstemp from unittest import mock import pytest from w3lib.url import path_to_file_uri from scrapy.core.downloader.handl...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_downloadermiddleware_cookies.py
tests/test_downloadermiddleware_cookies.py
import logging import pytest from testfixtures import LogCapture from scrapy.downloadermiddlewares.cookies import CookiesMiddleware from scrapy.downloadermiddlewares.defaultheaders import DefaultHeadersMiddleware from scrapy.downloadermiddlewares.redirect import RedirectMiddleware from scrapy.exceptions import NotCon...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_command_genspider.py
tests/test_command_genspider.py
from __future__ import annotations import re from pathlib import Path import pytest from tests.test_commands import TestProjectBase from tests.utils.cmdline import call, proc def find_in_file(filename: Path, regex: str) -> re.Match | None: """Find first pattern occurrence in file""" pattern = re.compile(re...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_commands.py
tests/test_commands.py
from __future__ import annotations import argparse import json from io import StringIO from shutil import copytree from typing import TYPE_CHECKING from unittest import mock import pytest import scrapy from scrapy.cmdline import _pop_command_name, _print_unknown_command_msg from scrapy.commands import ScrapyCommand,...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_conf.py
tests/test_utils_conf.py
import pytest from scrapy.exceptions import UsageError from scrapy.settings import BaseSettings, Settings from scrapy.utils.conf import ( arglist_to_dict, build_component_list, feed_complete_default_values_from_settings, feed_process_params_from_cli, ) class TestBuildComponentList: def test_build...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_scheduler.py
tests/test_scheduler.py
from __future__ import annotations import shutil import tempfile import warnings from abc import ABC, abstractmethod from collections import deque from typing import Any, NamedTuple import pytest from twisted.internet.defer import inlineCallbacks from scrapy.core.downloader import Downloader from scrapy.core.schedul...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_crawler.py
tests/test_crawler.py
import asyncio import logging import platform import re import signal import subprocess import sys import warnings from abc import ABC, abstractmethod from collections.abc import Generator from pathlib import Path from typing import Any import pytest from packaging.version import parse as parse_version from pexpect.po...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
true
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_request_cb_kwargs.py
tests/test_request_cb_kwargs.py
from testfixtures import LogCapture from twisted.internet.defer import inlineCallbacks from scrapy.http import Request from scrapy.utils.test import get_crawler from tests.mockserver.http import MockServer from tests.spiders import MockServerSpider class InjectArgumentsDownloaderMiddleware: """ Make sure dow...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spidermiddleware_base.py
tests/test_spidermiddleware_base.py
from __future__ import annotations from typing import TYPE_CHECKING, Any import pytest from scrapy import Request, Spider from scrapy.http import Response from scrapy.spidermiddlewares.base import BaseSpiderMiddleware from scrapy.utils.test import get_crawler if TYPE_CHECKING: from scrapy.crawler import Crawler...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_downloadermiddleware_httpcache.py
tests/test_downloadermiddleware_httpcache.py
from __future__ import annotations import email.utils import shutil import tempfile import time from contextlib import contextmanager from typing import TYPE_CHECKING, Any import pytest from scrapy.downloadermiddlewares.httpcache import HttpCacheMiddleware from scrapy.exceptions import IgnoreRequest from scrapy.http...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_addons.py
tests/test_addons.py
import itertools from typing import Any from unittest.mock import patch from twisted.internet.defer import inlineCallbacks from scrapy import Spider from scrapy.crawler import Crawler, CrawlerRunner from scrapy.exceptions import NotConfigured from scrapy.settings import BaseSettings, Settings from scrapy.utils.test i...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_downloadermiddleware_downloadtimeout.py
tests/test_downloadermiddleware_downloadtimeout.py
from scrapy.downloadermiddlewares.downloadtimeout import DownloadTimeoutMiddleware from scrapy.http import Request from scrapy.spiders import Spider from scrapy.utils.test import get_crawler class TestDownloadTimeoutMiddleware: def get_request_spider_mw(self, settings=None): crawler = get_crawler(Spider, ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_httpobj.py
tests/test_utils_httpobj.py
from urllib.parse import urlparse from scrapy.http import Request from scrapy.utils.httpobj import urlparse_cached def test_urlparse_cached(): url = "http://www.example.com/index.html" request1 = Request(url) request2 = Request(url) req1a = urlparse_cached(request1) req1b = urlparse_cached(reques...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/reactor_default.py
tests/CrawlerProcess/reactor_default.py
from twisted.internet import reactor # noqa: F401,TID253 from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess(settings={}) d = process...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_asyncio.py
tests/CrawlerProcess/twisted_reactor_asyncio.py
import scrapy from scrapy.crawler import CrawlerProcess class AsyncioReactorSpider(scrapy.Spider): name = "asyncio_reactor" process = CrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } ) process.crawl(AsyncioReactorSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_deferred_signal.py
tests/CrawlerProcess/asyncio_deferred_signal.py
from __future__ import annotations import asyncio import sys from scrapy import Spider from scrapy.crawler import CrawlerProcess from scrapy.utils.defer import deferred_from_coro class UppercasePipeline: async def _open_spider(self, spider): spider.logger.info("async pipeline opened!") await asy...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_enabled_no_reactor.py
tests/CrawlerProcess/asyncio_enabled_no_reactor.py
import scrapy from scrapy.crawler import CrawlerProcess from scrapy.utils.reactor import is_asyncio_reactor_installed class ReactorCheckExtension: def __init__(self): if not is_asyncio_reactor_installed(): raise RuntimeError("ReactorCheckExtension requires the asyncio reactor.") class NoRequ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_enabled_reactor.py
tests/CrawlerProcess/asyncio_enabled_reactor.py
import scrapy from scrapy.crawler import CrawlerProcess from scrapy.utils.asyncio import is_asyncio_available from scrapy.utils.reactor import ( install_reactor, is_asyncio_reactor_installed, is_reactor_installed, ) if is_reactor_installed(): raise RuntimeError( "Reactor already installed befor...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_select.py
tests/CrawlerProcess/twisted_reactor_select.py
import scrapy from scrapy.crawler import CrawlerProcess class SelectReactorSpider(scrapy.Spider): name = "epoll_reactor" process = CrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.selectreactor.SelectReactor", } ) process.crawl(SelectReactorSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/caching_hostname_resolver.py
tests/CrawlerProcess/caching_hostname_resolver.py
import sys import scrapy from scrapy.crawler import CrawlerProcess class CachingHostnameResolverSpider(scrapy.Spider): """ Finishes in a finite amount of time (does not hang indefinitely in the DNS resolution) """ name = "caching_hostname_resolver_spider" async def start(self): yield sc...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/multi.py
tests/CrawlerProcess/multi.py
import scrapy from scrapy.crawler import CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess(settings={}) process.crawl(NoRequestsSpider) process.crawl(NoRequestsSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_poll.py
tests/CrawlerProcess/twisted_reactor_poll.py
import scrapy from scrapy.crawler import CrawlerProcess class PollReactorSpider(scrapy.Spider): name = "poll_reactor" process = CrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.pollreactor.PollReactor", } ) process.crawl(PollReactorSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/reactor_select_twisted_reactor_select.py
tests/CrawlerProcess/reactor_select_twisted_reactor_select.py
from twisted.internet import selectreactor import scrapy from scrapy.crawler import CrawlerProcess selectreactor.install() class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess( settings={ "TWISTED_REACTOR": "tw...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/sleeping.py
tests/CrawlerProcess/sleeping.py
import sys from twisted.internet.defer import Deferred import scrapy from scrapy.crawler import CrawlerProcess from scrapy.utils.defer import maybe_deferred_to_future class SleepingSpider(scrapy.Spider): name = "sleeping" start_urls = ["data:,;"] async def parse(self, response): from twisted.i...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_custom_settings_conflict.py
tests/CrawlerProcess/twisted_reactor_custom_settings_conflict.py
from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess class SelectReactorSpider(scrapy.Spider): name = "select_reactor" custom_settings = { "TWISTED_REACTOR": "twisted.internet.selectreactor.SelectReactor", } class AsyncioReactorSpider(scrapy.Spider): name =...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/args_settings.py
tests/CrawlerProcess/args_settings.py
from typing import Any import scrapy from scrapy.crawler import Crawler, CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" @classmethod def from_crawler(cls, crawler: Crawler, *args: Any, **kwargs: Any): spider = super().from_crawler(crawler, *args, **kwargs) spid...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/simple.py
tests/CrawlerProcess/simple.py
import scrapy from scrapy.crawler import CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess(settings={}) process.crawl(NoRequestsSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_custom_settings_same.py
tests/CrawlerProcess/twisted_reactor_custom_settings_same.py
import scrapy from scrapy.crawler import CrawlerProcess class AsyncioReactorSpider1(scrapy.Spider): name = "asyncio_reactor1" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } class AsyncioReactorSpider2(scrapy.Spider): name = "asyncio_reactor...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/twisted_reactor_custom_settings.py
tests/CrawlerProcess/twisted_reactor_custom_settings.py
import scrapy from scrapy.crawler import CrawlerProcess class AsyncioReactorSpider(scrapy.Spider): name = "asyncio_reactor" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } process = CrawlerProcess() process.crawl(AsyncioReactorSpider) process.st...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_enabled_reactor_different_loop.py
tests/CrawlerProcess/asyncio_enabled_reactor_different_loop.py
import asyncio import sys from twisted.internet import asyncioreactor from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncioreactor.install() class NoRequestsSpider(scrapy...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/reactor_select_subclass_twisted_reactor_select.py
tests/CrawlerProcess/reactor_select_subclass_twisted_reactor_select.py
from twisted.internet.main import installReactor from twisted.internet.selectreactor import SelectReactor from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess class SelectReactorSubclass(SelectReactor): pass reactor = SelectReactorSubclass() installReactor(reactor) class NoR...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/reactor_default_twisted_reactor_select.py
tests/CrawlerProcess/reactor_default_twisted_reactor_select.py
from twisted.internet import reactor # noqa: F401,TID253 from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess( settings={ "...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/default_name_resolver.py
tests/CrawlerProcess/default_name_resolver.py
import scrapy from scrapy.crawler import CrawlerProcess class IPv6Spider(scrapy.Spider): """ Raises a twisted.internet.error.DNSLookupError: the default name resolver does not handle IPv6 addresses. """ name = "ipv6_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": proces...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/caching_hostname_resolver_ipv6.py
tests/CrawlerProcess/caching_hostname_resolver_ipv6.py
import scrapy from scrapy.crawler import CrawlerProcess class CachingHostnameResolverSpider(scrapy.Spider): """ Finishes without a twisted.internet.error.DNSLookupError exception """ name = "caching_hostname_resolver_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": process =...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/reactor_select.py
tests/CrawlerProcess/reactor_select.py
from twisted.internet import selectreactor from twisted.python import log import scrapy from scrapy.crawler import CrawlerProcess selectreactor.install() class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess(settings={}) d...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_custom_loop.py
tests/CrawlerProcess/asyncio_custom_loop.py
import scrapy from scrapy.crawler import CrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = CrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", "ASYNC...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerProcess/asyncio_enabled_reactor_same_loop.py
tests/CrawlerProcess/asyncio_enabled_reactor_same_loop.py
import asyncio import sys from twisted.internet import asyncioreactor from uvloop import Loop import scrapy from scrapy.crawler import CrawlerProcess if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop(Loop()) asyncioreactor.install() class...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/__init__.py
tests/test_spiderloader/__init__.py
import contextlib import shutil import sys import warnings from pathlib import Path from unittest import mock import pytest from zope.interface.verify import verifyObject # ugly hack to avoid cyclic imports of scrapy.spiders when running this test # alone import scrapy from scrapy.crawler import CrawlerRunner from sc...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/spider2.py
tests/test_spiderloader/test_spiders/spider2.py
from scrapy.spiders import Spider class Spider2(Spider): name = "spider2" allowed_domains = ["scrapy2.org", "scrapy3.org"]
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/spider1.py
tests/test_spiderloader/test_spiders/spider1.py
from scrapy.spiders import Spider class Spider1(Spider): name = "spider1" allowed_domains = ["scrapy1.org", "scrapy3.org"]
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/__init__.py
tests/test_spiderloader/test_spiders/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/spider3.py
tests/test_spiderloader/test_spiders/spider3.py
from scrapy.spiders import Spider class Spider3(Spider): name = "spider3" allowed_domains = ["spider3.com"] @classmethod def handles_request(cls, request): return request.url == "http://spider3.com/onlythis"
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/spider0.py
tests/test_spiderloader/test_spiders/spider0.py
from scrapy.spiders import Spider class Spider0(Spider): allowed_domains = ["scrapy1.org", "scrapy3.org"]
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/nested/spider4.py
tests/test_spiderloader/test_spiders/nested/spider4.py
from scrapy.spiders import Spider class Spider4(Spider): name = "spider4" allowed_domains = ["spider4.com"] @classmethod def handles_request(cls, request): return request.url == "http://spider4.com/onlythis"
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/test_spiders/nested/__init__.py
tests/test_spiderloader/test_spiders/nested/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/spiders_from_addons/__init__.py
tests/test_spiderloader/spiders_from_addons/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_spiderloader/spiders_from_addons/spider0.py
tests/test_spiderloader/spiders_from_addons/spider0.py
from scrapy.spiders import Spider class SpiderFromAddon(Spider): name = "spider_from_addon" allowed_domains = ["scrapy1.org", "scrapy3.org"]
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/mocks/dummydbm.py
tests/mocks/dummydbm.py
"""DBM-like dummy module""" from collections import defaultdict from typing import Any class DummyDB(dict): """Provide dummy DBM-like interface.""" def close(self): pass error = KeyError _DATABASES: defaultdict[Any, DummyDB] = defaultdict(DummyDB) def open(file, flag="r", mode=0o666): # noqa:...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/mocks/__init__.py
tests/mocks/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_settings/default_settings.py
tests/test_settings/default_settings.py
TEST_DEFAULT = "defvalue" TEST_DICT = {"key": "val"}
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_settings/__init__.py
tests/test_settings/__init__.py
# pylint: disable=unsubscriptable-object,unsupported-membership-test,use-implicit-booleaness-not-comparison # (too many false positives) import warnings from unittest import mock import pytest from scrapy.core.downloader.handlers.file import FileDownloadHandler from scrapy.settings import ( SETTINGS_PRIORITIES, ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
true
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/custom_loop_different.py
tests/AsyncCrawlerRunner/custom_loop_different.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/multi_parallel.py
tests/AsyncCrawlerRunner/multi_parallel.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/multi_seq.py
tests/AsyncCrawlerRunner/multi_seq.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/simple_default_reactor.py
tests/AsyncCrawlerRunner/simple_default_reactor.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging class NoRequestsSpider(Spider): name = "no_request" async def start(self): return ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/custom_loop_same.py
tests/AsyncCrawlerRunner/custom_loop_same.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerRunner/simple.py
tests/AsyncCrawlerRunner/simple.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import AsyncCrawlerRunner from scrapy.utils.defer import deferred_f_from_coro_f from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request"...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline/extensions.py
tests/test_cmdline/extensions.py
"""A test extension used to check the settings loading order""" class TestExtension: def __init__(self, settings): settings.set("TEST1", f"{settings['TEST1']} + started") @classmethod def from_crawler(cls, crawler): return cls(crawler.settings) class DummyExtension: pass
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline/settings.py
tests/test_cmdline/settings.py
from pathlib import Path EXTENSIONS = { "tests.test_cmdline.extensions.TestExtension": 0, } TEST1 = "default" FEEDS = { Path("items.csv"): { "format": "csv", "fields": ["price", "name"], }, }
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline/__init__.py
tests/test_cmdline/__init__.py
import json import os import pstats import shutil import sys import tempfile from io import StringIO from pathlib import Path from subprocess import PIPE, Popen from scrapy.utils.test import get_testenv class TestCmdline: def setup_method(self): self.env = get_testenv() tests_path = Path(__file__...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/reactor_default.py
tests/AsyncCrawlerProcess/reactor_default.py
from twisted.internet import reactor # noqa: F401,TID253 import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = AsyncCrawlerProcess(settings={}) d = process.crawl(NoRequestsSpid...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_custom_loop_custom_settings_different.py
tests/AsyncCrawlerProcess/asyncio_custom_loop_custom_settings_different.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" custom_settings = { "ASYNCIO_EVENT_LOOP": "uvloop.Loop", } async def start(self): return yield process = AsyncCrawlerProcess( settings={ "TWIST...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/twisted_reactor_asyncio.py
tests/AsyncCrawlerProcess/twisted_reactor_asyncio.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class AsyncioReactorSpider(scrapy.Spider): name = "asyncio_reactor" process = AsyncCrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } ) process.crawl(AsyncioReactorSpider) process....
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_deferred_signal.py
tests/AsyncCrawlerProcess/asyncio_deferred_signal.py
from __future__ import annotations import asyncio import sys from scrapy import Spider from scrapy.crawler import AsyncCrawlerProcess from scrapy.utils.defer import deferred_from_coro class UppercasePipeline: async def _open_spider(self, spider): spider.logger.info("async pipeline opened!") awai...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_enabled_no_reactor.py
tests/AsyncCrawlerProcess/asyncio_enabled_no_reactor.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess from scrapy.utils.reactor import is_asyncio_reactor_installed class ReactorCheckExtension: def __init__(self): if not is_asyncio_reactor_installed(): raise RuntimeError("ReactorCheckExtension requires the asyncio reactor.") class N...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_enabled_reactor.py
tests/AsyncCrawlerProcess/asyncio_enabled_reactor.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess from scrapy.utils.reactor import ( install_reactor, is_asyncio_reactor_installed, is_reactor_installed, ) if is_reactor_installed(): raise RuntimeError( "Reactor already installed before is_asyncio_reactor_installed()." ) try: ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/caching_hostname_resolver.py
tests/AsyncCrawlerProcess/caching_hostname_resolver.py
import sys import scrapy from scrapy.crawler import AsyncCrawlerProcess class CachingHostnameResolverSpider(scrapy.Spider): """ Finishes in a finite amount of time (does not hang indefinitely in the DNS resolution) """ name = "caching_hostname_resolver_spider" async def start(self): yie...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/multi.py
tests/AsyncCrawlerProcess/multi.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = AsyncCrawlerProcess(settings={}) process.crawl(NoRequestsSpider) process.crawl(NoRequestsSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/sleeping.py
tests/AsyncCrawlerProcess/sleeping.py
import asyncio import sys import scrapy from scrapy.crawler import AsyncCrawlerProcess class SleepingSpider(scrapy.Spider): name = "sleeping" start_urls = ["data:,;"] async def parse(self, response): await asyncio.sleep(int(sys.argv[1])) process = AsyncCrawlerProcess(settings={}) process.cra...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_custom_loop_custom_settings_same.py
tests/AsyncCrawlerProcess/asyncio_custom_loop_custom_settings_same.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" custom_settings = { "ASYNCIO_EVENT_LOOP": "uvloop.Loop", } async def start(self): return yield process = AsyncCrawlerProcess( settings={ "TWIST...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/args_settings.py
tests/AsyncCrawlerProcess/args_settings.py
from typing import Any import scrapy from scrapy.crawler import AsyncCrawlerProcess, Crawler class NoRequestsSpider(scrapy.Spider): name = "no_request" @classmethod def from_crawler(cls, crawler: Crawler, *args: Any, **kwargs: Any): spider = super().from_crawler(crawler, *args, **kwargs) ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_select.py
tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_select.py
from __future__ import annotations import logging from typing import TYPE_CHECKING import scrapy from scrapy.crawler import AsyncCrawlerProcess if TYPE_CHECKING: from asyncio import Task class AsyncioReactorSpider(scrapy.Spider): name = "asyncio_reactor" custom_settings = { "TWISTED_REACTOR": "...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/simple.py
tests/AsyncCrawlerProcess/simple.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = AsyncCrawlerProcess(settings={}) process.crawl(NoRequestsSpider) process.start()
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_same.py
tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_same.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class AsyncioReactorSpider1(scrapy.Spider): name = "asyncio_reactor1" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } class AsyncioReactorSpider2(scrapy.Spider): name = "asyncio_re...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/twisted_reactor_custom_settings.py
tests/AsyncCrawlerProcess/twisted_reactor_custom_settings.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class AsyncioReactorSpider(scrapy.Spider): name = "asyncio_reactor" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } process = AsyncCrawlerProcess() process.crawl(AsyncioReactorSpider) ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_enabled_reactor_different_loop.py
tests/AsyncCrawlerProcess/asyncio_enabled_reactor_different_loop.py
import asyncio import sys from twisted.internet import asyncioreactor import scrapy from scrapy.crawler import AsyncCrawlerProcess if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncioreactor.install(asyncio.get_event_loop()) class NoRequestsSpider(scrapy.S...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/default_name_resolver.py
tests/AsyncCrawlerProcess/default_name_resolver.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class IPv6Spider(scrapy.Spider): """ Raises a twisted.internet.error.DNSLookupError: the default name resolver does not handle IPv6 addresses. """ name = "ipv6_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": p...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/caching_hostname_resolver_ipv6.py
tests/AsyncCrawlerProcess/caching_hostname_resolver_ipv6.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class CachingHostnameResolverSpider(scrapy.Spider): """ Finishes without a twisted.internet.error.DNSLookupError exception """ name = "caching_hostname_resolver_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": proc...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_custom_loop.py
tests/AsyncCrawlerProcess/asyncio_custom_loop.py
import scrapy from scrapy.crawler import AsyncCrawlerProcess class NoRequestsSpider(scrapy.Spider): name = "no_request" async def start(self): return yield process = AsyncCrawlerProcess( settings={ "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/AsyncCrawlerProcess/asyncio_enabled_reactor_same_loop.py
tests/AsyncCrawlerProcess/asyncio_enabled_reactor_same_loop.py
import asyncio import sys from twisted.internet import asyncioreactor from uvloop import Loop import scrapy from scrapy.crawler import AsyncCrawlerProcess if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop(Loop()) asyncioreactor.install(asyn...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/explicit_default_reactor.py
tests/CrawlerRunner/explicit_default_reactor.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging class NoRequestsSpider(Spider): name = "no_request" custom_settings = { "TWISTED_REACTOR": None, } async def start(self): return ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/custom_loop_different.py
tests/CrawlerRunner/custom_loop_different.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request" custom_settings = { "TWISTED_REACTOR": "twist...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/multi_parallel.py
tests/CrawlerRunner/multi_parallel.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request" async def start(self): return yield ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/ip_address.py
tests/CrawlerRunner/ip_address.py
# ruff: noqa: E402 from scrapy.utils.reactor import install_reactor from tests.mockserver.dns import MockDNSServer from tests.mockserver.http import MockServer install_reactor("twisted.internet.asyncioreactor.AsyncioSelectorReactor") from twisted.names import cache, resolve from twisted.names import hosts as hostsM...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/multi_seq.py
tests/CrawlerRunner/multi_seq.py
from twisted.internet.defer import inlineCallbacks from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request" as...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/custom_loop_same.py
tests/CrawlerRunner/custom_loop_same.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request" custom_settings = { "TWISTED_REACTOR": "twist...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/change_reactor.py
tests/CrawlerRunner/change_reactor.py
from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging class NoRequestsSpider(Spider): name = "no_request" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } async def start(self): ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/CrawlerRunner/simple.py
tests/CrawlerRunner/simple.py
from twisted.internet.task import react from scrapy import Spider from scrapy.crawler import CrawlerRunner from scrapy.utils.log import configure_logging from scrapy.utils.reactor import install_reactor class NoRequestsSpider(Spider): name = "no_request" async def start(self): return yield ...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/test_return_with_argument_inside_generator.py
tests/test_utils_misc/test_return_with_argument_inside_generator.py
import warnings from functools import partial from unittest import mock import pytest from scrapy.utils.misc import ( is_generator_with_return_value, warn_on_generator_with_return_value, ) def _indentation_error(*args, **kwargs): raise IndentationError def top_level_return_something(): """ doc...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/__init__.py
tests/test_utils_misc/__init__.py
import os import sys from pathlib import Path from unittest import mock import pytest from scrapy.item import Field, Item from scrapy.utils.misc import ( arg_to_iter, build_from_crawler, load_object, rel_has_nofollow, set_environ, walk_modules, ) class TestUtilsMisc: def test_load_object...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/test_walk_modules/mod1.py
tests/test_utils_misc/test_walk_modules/mod1.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/test_walk_modules/__init__.py
tests/test_utils_misc/test_walk_modules/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/test_walk_modules/mod/__init__.py
tests/test_utils_misc/test_walk_modules/mod/__init__.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_utils_misc/test_walk_modules/mod/mod0.py
tests/test_utils_misc/test_walk_modules/mod/mod0.py
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/utils/__init__.py
tests/utils/__init__.py
import os from pathlib import Path from twisted.internet.defer import Deferred def twisted_sleep(seconds): from twisted.internet import reactor d = Deferred() reactor.callLater(seconds, d.callback, None) return d def get_script_run_env() -> dict[str, str]: """Return a OS environment dict suita...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/utils/cmdline.py
tests/utils/cmdline.py
from __future__ import annotations import subprocess import sys from typing import Any import pytest from scrapy.utils.test import get_testenv def call(*args: str, **popen_kwargs: Any) -> int: args = (sys.executable, "-m", "scrapy.cmdline", *args) return subprocess.call( args, stdout=subpro...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline_crawl_with_pipeline/__init__.py
tests/test_cmdline_crawl_with_pipeline/__init__.py
import sys from pathlib import Path from subprocess import PIPE, Popen from tests import TWISTED_KEEPS_TRACEBACKS class TestCmdlineCrawlPipeline: def _execute(self, spname): args = (sys.executable, "-m", "scrapy.cmdline", "crawl", spname) cwd = Path(__file__).resolve().parent proc = Popen...
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline_crawl_with_pipeline/test_spider/pipelines.py
tests/test_cmdline_crawl_with_pipeline/test_spider/pipelines.py
class TestSpiderPipeline: def open_spider(self, spider): pass def process_item(self, item): return item class TestSpiderExceptionPipeline: def open_spider(self, spider): raise RuntimeError("exception") def process_item(self, item): return item
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false
scrapy/scrapy
https://github.com/scrapy/scrapy/blob/d1bd8eb49f7aba9289e4ff692006cead8bcd9080/tests/test_cmdline_crawl_with_pipeline/test_spider/settings.py
tests/test_cmdline_crawl_with_pipeline/test_spider/settings.py
BOT_NAME = "test_spider" SPIDER_MODULES = ["test_spider.spiders"]
python
BSD-3-Clause
d1bd8eb49f7aba9289e4ff692006cead8bcd9080
2026-01-04T14:38:41.023839Z
false