Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[run]
source = mesohops
relative_files = true
omit =
*/tests/*
*/test_*
setup.py
*/venv/*
*/virtualenv/*
*/site-packages/*
*/timing/timing_analysis.py
*/timing/helper_functions/*
*/timing/timing_models/*
*/timing/__init__.py

[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
class .*\bProtocol\):
@(abc\.)?abstractmethod

[html]
directory = htmlcov
106 changes: 106 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Code Coverage

on:
pull_request:
branches: [ main, master ]

permissions:
contents: read
pull-requests: write
checks: write # Needed for test reporting

jobs:
coverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.12', '3.13']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies (editable)
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Run tests with coverage
continue-on-error: true
run: |
# Run tests and generate both coverage and test report
pytest --cov=mesohops --cov-report=xml --cov-report=term --junitxml=test-results.xml -v || true

# Show test results summary
echo "=== Test Results Summary ==="
if [ -f test-results.xml ]; then
echo "Test results file generated"
# Count total tests
total_tests=$(grep -c "<testcase" test-results.xml)
# Count failed tests
failed_tests=$(grep -c "<failure" test-results.xml)
echo "Total tests: $total_tests"
echo "Failed tests: $failed_tests"
echo "Passed tests: $((total_tests - failed_tests))"
else
echo "No test results file generated"
fi

- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: Python Coverage
fail_ci_if_error: false
verbose: true

- name: Publish Test Results
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: 'test-results.xml'
check_name: 'Python Unit Tests (${{ matrix.python-version }})'
fail_on_failure: false
require_tests: false

smoke-install:
# Validates that `pip install .` (non-editable) succeeds and that the
# installed package can run the test suite. Catches packaging bugs the
# editable-install coverage job hides — missing files in the wheel,
# broken pyproject.toml metadata, dependency-resolution failures.
# Gating: a failed clean install must block the PR.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.12', '3.13']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Clean install (non-editable)
run: |
python -m pip install --upgrade pip
pip install .

- name: Run level-1 tests against installed package
run: |
# Override pytest.ini's addopts to disable coverage measurement here.
# Coverage is the editable-install job's responsibility; in the smoke
# job, the installed-package paths can't be reconciled with the
# `source = mesohops` setting in .coveragerc, so --cov-fail-under=70
# would always trip on a 0% reading.
pytest tests/ --level 1 -v -o addopts=""
25 changes: 25 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
comment:
layout: "diff, flags, files" # Shows coverage diff, flags, and file list
behavior: default
require_changes: false # Always post comment, even if no coverage changes
require_base: false # Don't require base report
require_head: true # Require head report
hide_project_coverage: false # Show project coverage

coverage:
status:
project:
default:
target: auto # Compare to previous base commit
threshold: 0% # No threshold requirement
informational: true # Don't block PRs
patch:
default:
target: auto
threshold: 0%
informational: true # Don't block PRs

codecov:
require_ci_to_pass: false # Show coverage even if CI fails
notify:
wait_for_ci: false # Send notifications immediately
29 changes: 19 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
[project]
name = "mesohops"
version = "1.6.0"
version = "1.7.0"
# numba and numpy are pinned to a single minor version. numba minor
# releases have introduced stochastic test failures and memory issues,
# and numba binds against a specific numpy ABI. Upper-bound bumps for
# either dependency require running the level-2 test suite against the
# candidate version.
dependencies = [
"numpy",
"scipy",
"numba",
"pytest",
"pytest-level",
"pytest-cov"
"numpy>=2.3,<2.4",
"scipy>=1.15,<2.0",
"numba>=0.63,<0.64",
"pytest>=8.3,<9.0",
"pytest-level>=0.1,<0.2",
"pytest-cov>=6.0,<7.0",
]
requires-python = ">=3.12"
requires-python = ">=3.12,<3.14"
authors = [
{name = "Leonel Varvelo", email = "leonel_varvelo@yahoo.com"},
{name = "Jacob Lynd", email = "jacobklynd@gmail.com"},
Expand All @@ -29,11 +34,15 @@ readme = "README.md"
license = {file = "LICENSE"}
keywords = ["open quantum systems", "mesoscale", "spectroscopy", "excited-state dynamics", "non-Markovian"]
classifiers = [
"Development Status :: full release 1.6.0",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python"
]


[project.urls]
Homepage = "https://captainexasperated.github.io/Readthedocs-Tutorial/"
Repository = "https://github.com/MesoscienceLab/mesohops"

[tool.pytest.ini_options]
markers = [
"order: mark test to run in a specific order"
]
Loading
Loading