Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up tox-conda/pytest #1

Merged
merged 15 commits into from
Nov 22, 2024
Merged

Set up tox-conda/pytest #1

merged 15 commits into from
Nov 22, 2024

Commits on Nov 7, 2024

  1. Set up tox-conda/pytest

    - Set build-backend so isolated pip install works
    - Add pychop as testing dependency
    - Configure tox-conda
    - Create __init__.py files under tests/ so that all tests are
      found by pytest
    
    We need to use conda to install Mantid and check results against Abins
    functions. Tox-conda is stuck on tox v3; there is a branch to support
    v4 but it's not clear if/when this will be finished. But we also might
    be able to drop the conda component of these tests once we are
    satisfied with validation against Mantid: it can be replaced with
    tests against reference values.
    
    Perhaps we don't need the test dependencies at all in pyproject.toml,
    now this is all defined in tox.ini. But they could be useful for
    running tests without tox if desired.
    ajjackson committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    88391f9 View commit details
    Browse the repository at this point in the history
  2. Create a run_tests Action

    ajjackson committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    f0785ae View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e5a3c3c View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2024

  1. Streamline unit_test

    - Use reservoir sampling to efficiently grab a subset of Fermi chopper
      frequency combinations
    - Simplify error matching with match= argument
    - Get id on the fly with a function rather than precomputing
    ajjackson committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    eb7f15c View commit details
    Browse the repository at this point in the history
  2. Rework test matrices:

    - defer string ids to a function run by test
    - replace explicit list-extending with itertools.chain
    ajjackson committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    bd5d48e View commit details
    Browse the repository at this point in the history
  3. More unit_tests cleanup: type annotations, stricter error check

    The sweep of incident energies is cut down by some more (seeded)
    random sampling.
    
    At the moment we have some cases with invalid chopper frequencies;
    make sure the error is checked robustly when handling these.
    
    Ideally we should have smarter test-case generation and check the
    errors in a separate test
    ajjackson committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    64e8b75 View commit details
    Browse the repository at this point in the history
  4. Update pyproject.toml with another test dependency.

    These aren't currently being checked in CI because tox takes care of
    it, so can easily become stale. There must be a better way.
    ajjackson committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    9210cdc View commit details
    Browse the repository at this point in the history
  5. enable integration tests

    ajjackson committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    8928d96 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2024

  1. Try running on windows as well

    We are seeing some interesting inconsistencies in test results between
    Rastislav's local Windows installation and my Linux/tox setup.
    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    2872756 View commit details
    Browse the repository at this point in the history
  2. Disable fail-fast

    We know some tests are failing regardless, but want to see what
    happens on Windows!
    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    b5e2676 View commit details
    Browse the repository at this point in the history
  3. Tweak Abins-Pychop test; LinAlgError is only encountered on Windows

    When testing on Linux, Abins returns NaN rather than raise LinAlgError
    when the chopper settings are out of range. Our test should detect
    both cases and ensure appropriate behaviour in corresponding
    situation. (i.e. raise NoTransmissionError)
    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    4fc9ab8 View commit details
    Browse the repository at this point in the history
  4. Indentation matters

    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    4c7023e View commit details
    Browse the repository at this point in the history
  5. Detect PyChop Warning in Abins integration test

    This is a bit cleaner than having separate checks for different
    OS/Library situations
    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    8efd6dc View commit details
    Browse the repository at this point in the history
  6. Skip Lagrange low-frequency comparison with Abins

    There is a unit-conversion bug in the low-frequency limit so this
    doesn't kick in at the right place in Abins. When that is fixed we can
    de-skip the test and verify it here.
    ajjackson committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    1a45e22 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    26a3d33 View commit details
    Browse the repository at this point in the history