From 2f436c05e088b063b70f000a638409772df27138 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sun, 8 Oct 2023 22:55:05 +0400 Subject: [PATCH] Use SIGBREAK in Windows tests. --- tests/test_crawler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_crawler.py b/tests/test_crawler.py index b43a5826c..60b92377d 100644 --- a/tests/test_crawler.py +++ b/tests/test_crawler.py @@ -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()