소스 검색

chore(ci): Collect coverage from parallel test workers

Configure coverage.py for multiprocessing so Django's parallel test
workers are included in the coverage data.

Move coverage source and report settings into pyproject.toml,
and combine per-process coverage data before generating the report.

Fixes #22118
Martin Hauser 2 달 전
부모
커밋
4407505f87
2개의 변경된 파일19개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      .github/workflows/ci.yml
  2. 13 0
      pyproject.toml

+ 6 - 6
.github/workflows/ci.yml

@@ -122,12 +122,12 @@ jobs:
 
 
     - name: Run tests with coverage
     - name: Run tests with coverage
       if: ${{ matrix.coverage }}
       if: ${{ matrix.coverage }}
-      run: >-
-        coverage run --source="netbox/"
-        netbox/manage.py test netbox/ --parallel
+      run: coverage run netbox/manage.py test netbox/ --parallel
+
+    - name: Combine coverage data
+      if: ${{ matrix.coverage }}
+      run: coverage combine
 
 
     - name: Show coverage report
     - name: Show coverage report
       if: ${{ matrix.coverage }}
       if: ${{ matrix.coverage }}
-      run: >-
-        coverage report --skip-covered
-        --omit '*/migrations/*,*/tests/*'
+      run: coverage report

+ 13 - 0
pyproject.toml

@@ -26,6 +26,19 @@ Documentation = "https://netboxlabs.com/docs/netbox/"
 Source = "https://github.com/netbox-community/netbox"
 Source = "https://github.com/netbox-community/netbox"
 Issues = "https://github.com/netbox-community/netbox/issues"
 Issues = "https://github.com/netbox-community/netbox/issues"
 
 
+[tool.coverage.run]
+source = ["netbox/"]
+concurrency = ["multiprocessing"]
+parallel = true
+sigterm = true
+
+[tool.coverage.report]
+skip_covered = true
+omit = [
+    "*/migrations/*",
+    "*/tests/*",
+]
+
 [tool.pyright]
 [tool.pyright]
 include = ["netbox"]
 include = ["netbox"]
 exclude = [
 exclude = [