mirror of https://github.com/scrapy/scrapy.git
Assorted test fixes (#7585)
* Fix the mitmproxy junitxml file name. * Fix TestAsyncCrawlerRunnerHasSpider regression. * Update split out file refs. * Update the test_counter_handler() docstring.
This commit is contained in:
parent
4e956bd2de
commit
ddafb37a7c
|
|
@ -24,13 +24,13 @@ def _py_files(folder):
|
||||||
collect_ignore = [
|
collect_ignore = [
|
||||||
# may need extra deps
|
# may need extra deps
|
||||||
"docs/_ext",
|
"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"),
|
*_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"),
|
*_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"),
|
*_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"),
|
*_py_files("tests/CrawlerRunner"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -764,8 +764,8 @@ class TestCrawlerRunnerHasSpider:
|
||||||
|
|
||||||
@pytest.mark.only_asyncio
|
@pytest.mark.only_asyncio
|
||||||
class TestAsyncCrawlerRunnerHasSpider(TestCrawlerRunnerHasSpider):
|
class TestAsyncCrawlerRunnerHasSpider(TestCrawlerRunnerHasSpider):
|
||||||
@staticmethod
|
@pytest.fixture
|
||||||
def _runner() -> CrawlerRunnerBase:
|
def runner(self) -> CrawlerRunnerBase:
|
||||||
return AsyncCrawlerRunner(get_reactor_settings())
|
return AsyncCrawlerRunner(get_reactor_settings())
|
||||||
|
|
||||||
def test_crawler_runner_asyncio_enabled_true(self) -> None: # type: ignore[override]
|
def test_crawler_runner_asyncio_enabled_true(self) -> None: # type: ignore[override]
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ from tests.utils.decorators import coroutine_test
|
||||||
def test_counter_handler() -> None:
|
def test_counter_handler() -> None:
|
||||||
"""Test that ``LogCounterHandler`` is always properly removed.
|
"""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))
|
c = sum(1 for h in logging.root.handlers if isinstance(h, LogCounterHandler))
|
||||||
assert c == 0
|
assert c == 0
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -307,4 +307,4 @@ deps =
|
||||||
mitmproxy; implementation_name != "pypy"
|
mitmproxy; implementation_name != "pypy"
|
||||||
httpx[http2,socks]
|
httpx[http2,socks]
|
||||||
commands =
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue