diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..4c6d3e1 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,26 @@ +[run] +source = vspace +omit = + */tests/* + */test_* + */__pycache__/* + */vspace_version.py +concurrency = multiprocessing +parallel = True +sigterm = True + +[report] +precision = 2 +show_missing = True +skip_covered = False + +exclude_lines = + pragma: no cover + def __repr__ + raise AssertionError + raise NotImplementedError + if __name__ == .__main__.: + @abstract + +[html] +directory = htmlcov diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4456c28..232761b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,11 +47,28 @@ jobs: echo "Running single unit test as diagnostic..." python -m pytest tests/Vspace_Explicit/test_vspace_explicit.py -v -s + - name: Enable subprocess coverage + run: | + # Install coverage subprocess support + echo "import coverage; coverage.process_startup()" > $(python -c "import site; print(site.getsitepackages()[0])")/coverage_subprocess.pth + # Set environment variable for coverage configuration + echo "COVERAGE_PROCESS_START=${{ github.workspace }}/.coveragerc" >> $GITHUB_ENV + - name: Run tests timeout-minutes: 20 run: | # Run all tests with verbose output, capture disabled to see subprocess output, and per-test timeout - python -m pytest tests/ -v -s --timeout=300 --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=vspace --cov-report=xml --cov-report=term + python -m pytest tests/ -v -s --timeout=300 --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov --cov-report=xml --cov-report=term + + - name: Combine coverage data + if: matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' + run: | + # Move all coverage files from subdirectories to repository root + find tests/ -name ".coverage.*" -type f -exec mv {} . \; 2>/dev/null || true + # Combine all coverage data files + python -m coverage combine + python -m coverage xml + python -m coverage report - name: Upload coverage to Codecov # Only upload from one runner to avoid redundant API calls diff --git a/docs/conf.py b/docs/conf.py index 5b5c0ea..9336e92 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,8 +13,6 @@ import os import sys sys.path.insert(0, os.path.abspath('.')) -sys.path.insert(0, os.path.abspath('sphinx_rtd_theme')) -import sphinx_rtd_theme # -- Project information ----------------------------------------------------- @@ -50,7 +48,6 @@ # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..84291a5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,49 @@ +[pytest] +# Pytest configuration for vspace + +# Test discovery patterns +python_files = test_*.py +python_classes = Test* +python_functions = test_* + +# Test options +addopts = + --verbose + --strict-markers + --cov-context=test + +# Coverage configuration for subprocess tracking +[coverage:run] +source = vspace +omit = + */tests/* + */test_* + */__pycache__/* + */vspace_version.py +concurrency = multiprocessing +parallel = True + +[coverage:report] +precision = 2 +show_missing = True +skip_covered = False + +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code + def __repr__ + + # Don't complain if tests don't hit defensive assertion code + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run + if __name__ == .__main__.: + + # Don't complain about abstract methods + @abstract + +[coverage:html] +directory = htmlcov