2019-08-22 18:15:02 +05:00
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
from pytest import mark
|
|
|
|
|
2019-12-04 21:32:16 +05:00
|
|
|
from scrapy.utils.asyncio import is_asyncio_reactor_installed, install_asyncio_reactor
|
2019-08-22 18:15:02 +05:00
|
|
|
|
|
|
|
|
|
|
|
@mark.usefixtures('reactor_pytest')
|
|
|
|
class AsyncioTest(TestCase):
|
|
|
|
|
2019-12-04 21:32:16 +05:00
|
|
|
def test_is_asyncio_reactor_installed(self):
|
2019-08-22 18:15:02 +05:00
|
|
|
# the result should depend only on the pytest --reactor argument
|
2019-12-26 20:46:54 +05:00
|
|
|
self.assertEqual(is_asyncio_reactor_installed(), self.reactor_pytest == 'asyncio')
|
2019-08-22 18:15:02 +05:00
|
|
|
|
|
|
|
def test_install_asyncio_reactor(self):
|
|
|
|
# this should do nothing
|
|
|
|
install_asyncio_reactor()
|