Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Use SIGBREAK in Windows tests.

Andrey Rakhmatullin2f436c05e088
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()