diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 04682da..63975d4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,8 +23,6 @@ jobs: include: - python-version: "3.14" os: macos-26 - - python-version: "3.15" - os: macos-26 steps: - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} @@ -60,36 +58,36 @@ jobs: with: fail_ci_if_error: false verbose: true - TestsIceTray: - env: - UV_SYSTEM_PYTHON: 1 - runs-on: ubuntu-latest - container: icecube/icetray:icetray-devel-current-ubuntu22.04-X64 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v6 - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - name: Install SimWeights - run: uv pip install -e .[test] - - name: Download Test Data - run: | - curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O - tar xzvf simweights_testdata.tar.gz - - name: Run Unit Tests - env: - SIMWEIGHTS_TESTDATA: . - run: /opt/icetray/bin/icetray-shell python -m pytest --junit-xml=test-results-icetray.junit.xml - - name: Upload Test Results - uses: actions/upload-artifact@v7 - if: always() - with: - if-no-files-found: error - name: test-results-icetray.junit.xml - path: test-results-icetray.junit.xml + # TestsIceTray: + # env: + # UV_SYSTEM_PYTHON: 1 + # runs-on: ubuntu-latest + # container: icecube/icetray:icetray-devel-current-ubuntu22.04-X64 + # strategy: + # fail-fast: false + # steps: + # - uses: actions/checkout@v6 + # - name: Install uv + # uses: astral-sh/setup-uv@v7 + # with: + # enable-cache: true + # - name: Install SimWeights + # run: uv pip install -e .[test] + # - name: Download Test Data + # run: | + # curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O + # tar xzvf simweights_testdata.tar.gz + # - name: Run Unit Tests + # env: + # SIMWEIGHTS_TESTDATA: . + # run: /opt/icetray/bin/icetray-shell python -m pytest --junit-xml=test-results-icetray.junit.xml + # - name: Upload Test Results + # uses: actions/upload-artifact@v7 + # if: always() + # with: + # if-no-files-found: error + # name: test-results-icetray.junit.xml + # path: test-results-icetray.junit.xml publish-test-results: name: "Publish Tests Results" needs: Tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a2c78a..efda701 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: blacken-docs args: [-l 100] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.12 + rev: v0.15.21 hooks: - id: ruff args: [--fix, --show-fixes] diff --git a/pyproject.toml b/pyproject.toml index f4e00ae..839fc15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,7 @@ ignore = [ "S101", # assert-used "COM812", # conflicts with ruff formatter "ISC001", # conflicts with ruff formatter + "PLR0913", # Too many arguments in function definition "PLR0911", # Too many return statement "PLW1641" # object does not implement `__hash__` method ] diff --git a/src/simweights/_generation_surface.py b/src/simweights/_generation_surface.py index eb3f2de..a7df87d 100644 --- a/src/simweights/_generation_surface.py +++ b/src/simweights/_generation_surface.py @@ -159,7 +159,7 @@ def get_cos_zenith_range(self: "CompositeSurface", pdgid: "PDGCode | None" = Non assert np.isfinite(czmax) return czmin, czmax - def __eq__(self, other: object) -> bool: + def __eq__(self: GenerationSurface, other: object) -> bool: # must handle the same set of particle types if isinstance(other, GenerationSurface): return self == CompositeSurface(other) diff --git a/tests/test_weighter.py b/tests/test_weighter.py index 2d13375..935ef14 100755 --- a/tests/test_weighter.py +++ b/tests/test_weighter.py @@ -4,6 +4,7 @@ # # SPDX-License-Identifier: BSD-2-Clause +import contextlib import unittest from copy import deepcopy @@ -11,6 +12,9 @@ from simweights import TIG1996, IceTopSurface, NaturalRateCylinder, NuGenSurface, PowerLaw, Weighter +with contextlib.suppress(ImportError): + import nuflux + def fluxfun1(energy): return energy**2 @@ -311,7 +315,7 @@ def test_nuflux(self): weighter1.add_weight_column("energy", data1["I3Weight"]["energy"]) weighter1.add_weight_column("cos_zen", np.cos(data1["I3Weight"]["zenith"])) - honda = nuflux.makeFlux("honda2006") # noqa : F821 + honda = nuflux.makeFlux("honda2006") w = weighter1.get_weights(honda) fluxval = honda.getFlux(14, data1["I3Weight"]["energy"], np.cos(data1["I3Weight"]["zenith"])) oneweight = weighter1.get_weights(1)