mirror of https://github.com/scrapy/scrapy.git
Fix shutdown tests. (#6772)
This commit is contained in:
parent
5dfe7cd7b8
commit
ff1ac75c9e
|
|
@ -1,3 +1,5 @@
|
|||
import sys
|
||||
|
||||
from twisted.internet.defer import Deferred
|
||||
|
||||
import scrapy
|
||||
|
|
@ -14,7 +16,7 @@ class SleepingSpider(scrapy.Spider):
|
|||
from twisted.internet import reactor
|
||||
|
||||
d = Deferred()
|
||||
reactor.callLater(int(self.sleep), d.callback, None)
|
||||
reactor.callLater(int(sys.argv[1]), d.callback, None)
|
||||
await maybe_deferred_to_future(d)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -890,7 +890,7 @@ class TestCrawlerProcessSubprocess(ScriptRunnerMixin, unittest.TestCase):
|
|||
|
||||
def test_shutdown_graceful(self):
|
||||
sig = signal.SIGINT if sys.platform != "win32" else signal.SIGBREAK
|
||||
args = self.get_script_args("sleeping.py", "-a", "sleep=3")
|
||||
args = self.get_script_args("sleeping.py", "3")
|
||||
p = PopenSpawn(args, timeout=5)
|
||||
p.expect_exact("Spider opened")
|
||||
p.expect_exact("Crawled (200)")
|
||||
|
|
@ -904,7 +904,7 @@ class TestCrawlerProcessSubprocess(ScriptRunnerMixin, unittest.TestCase):
|
|||
from twisted.internet import reactor
|
||||
|
||||
sig = signal.SIGINT if sys.platform != "win32" else signal.SIGBREAK
|
||||
args = self.get_script_args("sleeping.py", "-a", "sleep=10")
|
||||
args = self.get_script_args("sleeping.py", "10")
|
||||
p = PopenSpawn(args, timeout=5)
|
||||
p.expect_exact("Spider opened")
|
||||
p.expect_exact("Crawled (200)")
|
||||
|
|
|
|||
Loading…
Reference in New Issue