Scrapy, a fast high-level web crawling & scraping framework for Python.
Fix tracking of coverage in subprocesses.
Andrey Rakhmatullin7dfbecd3924a
diff --git a/pyproject.toml b/pyproject.tomlindex 571a61f1c..29e26399f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -120,6 +120,12 @@ include = ["scrapy/*"]omit = ["tests/*"]disable_warnings = ["include-ignored"]+[tool.coverage.paths]+source = [+ "scrapy",+ ".tox/**/site-packages/scrapy"+]+[tool.coverage.report]# https://github.com/nedbat/coveragepy/issues/831#issuecomment-517778185exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]diff --git a/tests/__init__.py b/tests/__init__.pyindex 5f0c0f7ad..cd52ade58 100644--- a/tests/__init__.py+++ b/tests/__init__.py@@ -15,13 +15,6 @@ os.environ["http_proxy"] = ""os.environ["https_proxy"] = ""os.environ["ftp_proxy"] = ""-# Absolutize paths to coverage config and output file because tests that-# spawn subprocesses also changes current working directory.-_sourceroot = Path(__file__).resolve().parent.parent-if "COV_CORE_CONFIG" in os.environ:- os.environ["COVERAGE_FILE"] = str(_sourceroot / ".coverage")- os.environ["COV_CORE_CONFIG"] = str(_sourceroot / os.environ["COV_CORE_CONFIG"])-tests_datadir = str(Path(__file__).parent.resolve() / "sample_data")diff --git a/tox.ini b/tox.iniindex 39ab1ccd4..de91c8b04 100644--- a/tox.ini+++ b/tox.ini@@ -14,7 +14,7 @@ deps =pyftpdlib >= 2.0.1pygmentspytest- pytest-cov==4.0.0+ pytest-cov >= 4.0.0pytest-xdistsybil >= 1.3.0 # https://github.com/cjw296/sybil/issues/20#issuecomment-605433422testfixtures@@ -36,7 +36,7 @@ passenv =#allow tox virtualenv to upgrade pip/wheel/setuptoolsdownload = truecommands =- pytest --cov=scrapy --cov-report=xml --cov-report= {posargs:--durations=10 docs scrapy tests} --doctest-modules+ pytest --cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= {posargs:--durations=10 docs scrapy tests} --doctest-modulesinstall_command =python -I -m pip install -ctests/upper-constraints.txt {opts} {packages}@@ -115,7 +115,7 @@ setenv =install_command =python -I -m pip install {opts} {packages}commands =- pytest --cov=scrapy --cov-report=xml --cov-report= {posargs:--durations=10 scrapy tests}+ pytest --cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= {posargs:--durations=10 scrapy tests}[testenv:pinned]basepython = {[pinned]basepython}@@ -241,7 +241,7 @@ deps ={[testenv]deps}botocore>=1.4.87commands =- pytest --cov=scrapy --cov-report=xml --cov-report= {posargs:tests -m requires_botocore}+ pytest --cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= {posargs:tests -m requires_botocore}[testenv:botocore-pinned]basepython = {[pinned]basepython}@@ -252,4 +252,4 @@ install_command = {[pinned]install_command}setenv ={[pinned]setenv}commands =- pytest --cov=scrapy --cov-report=xml --cov-report= {posargs:tests -m requires_botocore}+ pytest --cov-config=pyproject.toml --cov=scrapy --cov-report=xml --cov-report= {posargs:tests -m requires_botocore}