Use SIGBREAK in Windows tests.

This commit is contained in:
Andrey Rakhmatullin 2023-10-08 22:55:05 +04:00
parent eb5e2e79ba
commit 2f436c05e0
1 changed files with 5 additions and 3 deletions

View File

@ -524,23 +524,25 @@ class CrawlerProcessSubprocess(ScriptRunnerMixin, unittest.TestCase):
self.assertIn("The value of FOO is 42", log)
def test_shutdown_graceful(self):
sig = signal.SIGINT if sys.platform != "win32" else signal.SIGBREAK
args = self.get_script_args("sleeping.py")
p = PopenSpawn(args, timeout=5)
p.expect_exact("Spider opened")
p.expect_exact("Crawled (200)")
p.kill(signal.SIGINT)
p.kill(sig)
p.expect_exact("shutting down gracefully")
p.expect_exact("Spider closed (shutdown)")
p.wait()
def test_shutdown_forced(self):
sig = signal.SIGINT if sys.platform != "win32" else signal.SIGBREAK
args = self.get_script_args("sleeping.py")
p = PopenSpawn(args, timeout=5)
p.expect_exact("Spider opened")
p.expect_exact("Crawled (200)")
p.kill(signal.SIGINT)
p.kill(sig)
p.expect_exact("shutting down gracefully")
p.kill(signal.SIGINT)
p.kill(sig)
p.expect_exact("forcing unclean shutdown")
p.wait()