Skip to content

Commit

Permalink
Merge pull request #106 from neutrons/ci_git_lfs_tests
Browse files Browse the repository at this point in the history
Include tests requiring git lfs in CI pipeline
  • Loading branch information
backmari authored Oct 21, 2024
2 parents a90c34f + cc73cb9 commit 8174025
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,37 @@ on:
jobs:

linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
outputs:
deploy_enabled: 'false'
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
channels: mantid/label/main,conda-forge,defaults
python-version: '3.10'
miniconda-version: latest
mamba-version: "*"
environment-file: environment.yml

- name: Restore/save LFS files in cache
id: cache-lfs
uses: actions/cache@v4
with:
path: test/data/reflectivity_ui-data/
key: ${{ runner.os }}-lfs-files

- name: Pull LFS files for the submodule
if: steps.cache-lfs.outputs.cache-hit != 'true'
run: git submodule update --init

- name: Unit test with code coverage
run: |
git submodule update --init
ls -l test/data/reflectivity_ui-data
xvfb-run -a python -m pytest -vv -m "not datarepo" --cov=reflectivity_ui --cov-report=xml --cov-report=term
# run tests requiring git lfs (may need to switch to a self-hosted runner)
xvfb-run -a python -m pytest -vv --cov=reflectivity_ui --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
1 change: 1 addition & 0 deletions docs/releasenotes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Notes for major and minor releases. Notes for Patch releases are deferred.

**Of interest to the Developer:**

- PR #106: Enable tests using the data repo git LFS files in the CI pipeline
- PR #XYZ: one-liner description


Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- sphinx
- sphinx_rtd_theme
- toml
- versioningit
- pip
- pip:
- versioningit
- check-wheel-contents
3 changes: 3 additions & 0 deletions test/ui/test_missing_cross_section.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# local imports
from reflectivity_ui.interfaces.configuration import Configuration
from reflectivity_ui.interfaces.main_window import MainWindow
from test.ui import ui_utilities

Expand All @@ -11,12 +12,14 @@
TEST_REFLECTIVITY_THRESHOLD_VALUE = 0.01


@pytest.mark.skip("Test fails in the CI pipeline, see EWM 7743")
@pytest.mark.datarepo
def test_missing_cross_section(qtbot):
r"""Test a run where the crossection corresponding to the On-On spin combination has no integrated
proton charge. The application produces and empty reflectivity curve for On-On."""
main_window = MainWindow()
qtbot.addWidget(main_window)
Configuration.setup_default_values()
# load the run and find the total "intensity" of the x vs TOF plot
ui_utilities.setText(main_window.numberSearchEntry, "42100", press_enter=True)
intensity_off_on = np.sum(ui_utilities.data_from_plot2D(main_window.xtof_overview))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_load_data_deadtime(data_server):
"""Test load data with and without dead-time correction"""
conf = Configuration()
file_path = data_server.path_to("REF_M_42112")
corrected_events = [52283.51, 42028.15, 66880.96, 43405.89]
corrected_events = [52226.65, 42024.57, 66802.82, 43401.94]

# load with dead-time correction
conf.apply_deadtime = True
Expand Down

0 comments on commit 8174025

Please sign in to comment.