Scrapy, a fast high-level web crawling & scraping framework for Python.
Assorted test fixes (#7585)
Andrey Rakhmatullinddafb37a7c6c
diff --git a/conftest.py b/conftest.pyindex 1674086ec..cf0568111 100644--- a/conftest.py+++ b/conftest.py@@ -24,13 +24,13 @@ def _py_files(folder):collect_ignore = [# may need extra deps"docs/_ext",- # contains scripts to be run by tests/test_crawler.py::AsyncCrawlerProcessSubprocess+ # contains scripts to be run by tests/test_crawler_subprocess.py::AsyncCrawlerProcessSubprocess*_py_files("tests/AsyncCrawlerProcess"),- # contains scripts to be run by tests/test_crawler.py::AsyncCrawlerRunnerSubprocess+ # contains scripts to be run by tests/test_crawler_subprocess.py::AsyncCrawlerRunnerSubprocess*_py_files("tests/AsyncCrawlerRunner"),- # contains scripts to be run by tests/test_crawler.py::CrawlerProcessSubprocess+ # contains scripts to be run by tests/test_crawler_subprocess.py::CrawlerProcessSubprocess*_py_files("tests/CrawlerProcess"),- # contains scripts to be run by tests/test_crawler.py::CrawlerRunnerSubprocess+ # contains scripts to be run by tests/test_crawler_subprocess.py::CrawlerRunnerSubprocess*_py_files("tests/CrawlerRunner"),]diff --git a/tests/test_crawler.py b/tests/test_crawler.pyindex 853d6cfaa..3cde38a6f 100644--- a/tests/test_crawler.py+++ b/tests/test_crawler.py@@ -764,8 +764,8 @@ class TestCrawlerRunnerHasSpider:@pytest.mark.only_asyncioclass TestAsyncCrawlerRunnerHasSpider(TestCrawlerRunnerHasSpider):- @staticmethod- def _runner() -> CrawlerRunnerBase:+ @pytest.fixture+ def runner(self) -> CrawlerRunnerBase:return AsyncCrawlerRunner(get_reactor_settings())def test_crawler_runner_asyncio_enabled_true(self) -> None: # type: ignore[override]diff --git a/tests/test_zz_resources.py b/tests/test_zz_resources.pyindex a8292745d..b2ba013f1 100644--- a/tests/test_zz_resources.py+++ b/tests/test_zz_resources.py@@ -15,7 +15,8 @@ from tests.utils.decorators import coroutine_testdef test_counter_handler() -> None:"""Test that ``LogCounterHandler`` is always properly removed.- It's added in ``Crawler.crawl{,_async}()`` and removed on engine_stopped.+ It's added in ``LogCount.spider_opened()`` and removed in+ ``LogCount.spider_closed()``."""c = sum(1 for h in logging.root.handlers if isinstance(h, LogCounterHandler))assert c == 0diff --git a/tox.ini b/tox.iniindex 602394761..e21e1f6cf 100644--- a/tox.ini+++ b/tox.ini@@ -307,4 +307,4 @@ deps =mitmproxy; implementation_name != "pypy"httpx[http2,socks]commands =- pytest {posargs:--cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= tests --junitxml=botocore.junit.xml -o junit_family=legacy} -m requires_mitmproxy+ pytest {posargs:--cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= tests --junitxml=mitmproxy.junit.xml -o junit_family=legacy} -m requires_mitmproxy