ENH: Use logging in project classes. BUG: Fixed tests. #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| # Test organization: | |
| # - Unit tests: Run on all PRs and pushes, no external data required | |
| # - Integration tests with data: Run on PRs, download and cache test data | |
| # - GPU tests (segmentation): Excluded from CI (requires CUDA), run locally | |
| # | |
| # Test markers: | |
| # - requires_data: Tests that need external data downloads | |
| # - slow: Tests that are computationally intensive or require GPU | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest pytest-cov | |
| - name: Run unit tests (no data required) | |
| run: | | |
| pytest tests/ -v -m "not requires_data and not slow" --cov=src/physiomotion4d --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| test-with-data: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest pytest-cov | |
| - name: Cache test data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| tests/data/ | |
| tests/results/ | |
| key: test-data-${{ hashFiles('tests/test_*.py') }}-v2 | |
| restore-keys: | | |
| test-data- | |
| - name: Run data download tests | |
| run: | | |
| pytest tests/test_download_heart_data.py -v --cov=src/physiomotion4d --cov-report=xml | |
| continue-on-error: true | |
| - name: Run data conversion tests | |
| run: | | |
| pytest tests/test_convert_nrrd_4d_to_3d.py -v --cov=src/physiomotion4d --cov-append --cov-report=xml | |
| continue-on-error: true | |
| - name: Run contour tools tests | |
| run: | | |
| pytest tests/test_contour_tools.py -v -m "not slow" --cov=src/physiomotion4d --cov-append --cov-report=xml | |
| continue-on-error: true | |
| - name: Run USD conversion tests | |
| run: | | |
| pytest tests/test_convert_vtk_4d_to_usd_polymesh.py -v -m "not slow" --cov=src/physiomotion4d --cov-append --cov-report=xml | |
| continue-on-error: true | |
| - name: Run existing USD tests | |
| run: | | |
| pytest tests/test_usd_merge.py tests/test_usd_time_preservation.py -v --cov=src/physiomotion4d --cov-append --cov-report=xml | |
| continue-on-error: true | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: integration-tests | |
| fail_ci_if_error: false | |
| # Note: Slow and GPU-dependent tests are excluded from CI | |
| # These tests should be run locally: | |
| # - tests/test_register_images_ants.py (slow, computationally intensive) | |
| # - tests/test_register_images_icon.py (requires CUDA for ICON) | |
| # - tests/test_transform_tools.py (depends on slow registration tests) | |
| # - tests/test_segment_chest_total_segmentator.py (requires CUDA for TotalSegmentator) | |
| # - tests/test_segment_chest_vista_3d.py (requires CUDA for VISTA-3D) | |
| # | |
| # To run slow/GPU tests locally: | |
| # pytest tests/ -v -m "slow" # Run all slow tests | |
| # pytest tests/test_register_images_ants.py -v -s | |
| # pytest tests/test_register_images_icon.py -v -s | |
| # pytest tests/test_transform_tools.py -v -s | |
| # pytest tests/test_segment_chest_total_segmentator.py -v -s | |
| # pytest tests/test_segment_chest_vista_3d.py -v -s |