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

Include tests requiring git lfs in CI pipeline #106

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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
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
Loading