Skip to content

Commit

Permalink
feat: Use the asyncio reactor, to be able to use yapw async clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jan 23, 2024
1 parent 04a5267 commit 1884445
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
RABBIT_URL: amqp://127.0.0.1:${{ job.services.rabbitmq.ports[5672] }}
TEST_API_URL: http://localhost:${{ job.services.httpbin.ports[80] }}/anything/
# For requests.post() in KingfisherProcessAPI2._post_synchronous().
run: pytest -W error -W ignore::ResourceWarning -rs --cov kingfisher_scrapy
run: pytest -W error -W ignore::ResourceWarning -rs --cov kingfisher_scrapy tests
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
Expand Down
2 changes: 2 additions & 0 deletions kingfisher_scrapy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@
if os.getenv('SCRAPY_PROJECT') is None:
# https://docs.scrapy.org/en/latest/topics/commands.html#commands-module
COMMANDS_MODULE = 'kingfisher_scrapy.commands'

TWISTED_REACTOR = 'twisted.internet.asyncioreactor.AsyncioSelectorReactor'
3 changes: 3 additions & 0 deletions tests/test_spiders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
from scrapy.crawler import Crawler, CrawlerRunner
from scrapy.http import Response
from scrapy.utils.reactor import install_reactor
from scrapy.utils.project import get_project_settings

from kingfisher_scrapy.exceptions import MissingEnvVarError
Expand All @@ -11,6 +12,8 @@
# See scrapy.cmdline.execute
settings = get_project_settings()
runner = CrawlerRunner(settings)
# https://docs.scrapy.org/en/latest/topics/asyncio.html#installing-the-asyncio-reactor
install_reactor('twisted.internet.asyncioreactor.AsyncioSelectorReactor')


# See scrapy.commands.list
Expand Down

0 comments on commit 1884445

Please sign in to comment.