From 94bc759c6ad0a13e56455ead46ba7e8c9a9971d0 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Mon, 19 Jan 2026 16:13:29 +0200 Subject: [PATCH] test: updates tests to include new logic --- tests/spiders/test_spider.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/spiders/test_spider.py b/tests/spiders/test_spider.py index 9cda3d7..c1edaed 100644 --- a/tests/spiders/test_spider.py +++ b/tests/spiders/test_spider.py @@ -443,13 +443,21 @@ class TestSpiderHooks: class TestSpiderPause: """Test Spider pause functionality.""" - def test_pause_without_engine_raises(self): - """Test that pause without active engine raises RuntimeError.""" + def test_pause_without_crawldir_raises(self): + """Test that pause without crawldir raises RuntimeError.""" spider = ConcreteSpider() - with pytest.raises(RuntimeError, match="no crawl engine started"): + with pytest.raises(RuntimeError, match="Cannot pause without crawldir"): spider.pause() + def test_pause_without_engine_raises(self): + """Test that pause without active engine raises RuntimeError.""" + with tempfile.TemporaryDirectory() as tmpdir: + spider = ConcreteSpider(crawldir=tmpdir) + + with pytest.raises(RuntimeError, match="no crawl engine started"): + spider.pause() + class TestSpiderStats: """Test Spider stats property."""