mirror of https://github.com/scrapy/scrapy.git
Make shutdown tests more robust.
This commit is contained in:
parent
991121fa91
commit
2cb1e10c76
|
|
@ -14,7 +14,7 @@ class SleepingSpider(scrapy.Spider):
|
|||
from twisted.internet import reactor
|
||||
|
||||
d = Deferred()
|
||||
reactor.callLater(3, d.callback, None)
|
||||
reactor.callLater(int(self.sleep), d.callback, None)
|
||||
await maybe_deferred_to_future(d)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ class CrawlerProcessSubprocess(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")
|
||||
args = self.get_script_args("sleeping.py", "-a", "sleep=3")
|
||||
p = PopenSpawn(args, timeout=5)
|
||||
p.expect_exact("Spider opened")
|
||||
p.expect_exact("Crawled (200)")
|
||||
|
|
@ -536,7 +536,7 @@ class CrawlerProcessSubprocess(ScriptRunnerMixin, unittest.TestCase):
|
|||
|
||||
def test_shutdown_forced(self):
|
||||
sig = signal.SIGINT if sys.platform != "win32" else signal.SIGBREAK
|
||||
args = self.get_script_args("sleeping.py")
|
||||
args = self.get_script_args("sleeping.py", "-a", "sleep=10")
|
||||
p = PopenSpawn(args, timeout=5)
|
||||
p.expect_exact("Spider opened")
|
||||
p.expect_exact("Crawled (200)")
|
||||
|
|
|
|||
Loading…
Reference in New Issue