Skip to content

Commit 412fb1d

Browse files
authored
Merge pull request #124 from scipp/cron-orso-files
Publish reduced orso files as part of nightly builds
2 parents 0a03844 + 48f70ea commit 412fb1d

File tree

5 files changed

+45
-2
lines changed

5 files changed

+45
-2
lines changed

.github/workflows/nightly_at_main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ jobs:
3131
os-variant: ${{ matrix.os }}
3232
python-version: ${{ matrix.python.version }}
3333
tox-env: ${{ matrix.python.tox-env }}
34+
test-artifacts-name: 'essreflectometry-test-artifacts-latest'
3435
secrets: inherit

.github/workflows/nightly_at_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ jobs:
3838
python-version: ${{ matrix.python.version }}
3939
tox-env: ${{ matrix.python.tox-env }}
4040
checkout_ref: ${{ needs.setup.outputs.release_tag }}
41+
test-artifacts-name: 'essreflectometry-test-artifacts-stable'
4142
secrets: inherit

.github/workflows/test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
checkout_ref:
2121
default: ''
2222
type: string
23+
test-artifacts-name:
24+
default: ''
25+
type: string
2326
workflow_call:
2427
inputs:
2528
os-variant:
@@ -39,6 +42,9 @@ on:
3942
checkout_ref:
4043
default: ''
4144
type: string
45+
test-artifacts-name:
46+
default: ''
47+
type: string
4248

4349
jobs:
4450
package-test:
@@ -71,9 +77,14 @@ jobs:
7177
python-version: ${{ inputs.python-version }}
7278
- run: python -m pip install --upgrade pip
7379
- run: python -m pip install -r ${{ inputs.pip-recipe }}
74-
- run: tox -e ${{ inputs.tox-env }}
80+
- run: tox -e ${{ inputs.tox-env }} -- --file-output="tests_outputs"
7581
- uses: actions/upload-artifact@v4
7682
if: ${{ inputs.coverage-report }}
7783
with:
7884
name: CoverageReport
7985
path: coverage_html/
86+
- uses: actions/upload-artifact@v4
87+
if: ${{ inputs.test-artifacts-name != '' }}
88+
with:
89+
name: ${{ inputs.test-artifacts-name }}
90+
path: tests_outputs/

tests/amor/pipeline_test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
3-
# flake8: noqa: F403, F405
3+
from pathlib import Path
44

55
import numpy as np
66
import pytest
@@ -91,6 +91,17 @@ def test_orso_pipeline(amor_pipeline: sciline.Pipeline):
9191
assert np.isfinite(res.data).all()
9292

9393

94+
@pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation")
95+
@pytest.mark.filterwarnings("ignore:Invalid transformation, missing attribute")
96+
def test_save_reduced_orso_file(amor_pipeline: sciline.Pipeline, output_folder: Path):
97+
from orsopy import fileio
98+
99+
amor_pipeline[SampleRotation[SampleRun]] = sc.scalar(0.85, unit="deg")
100+
amor_pipeline[Filename[SampleRun]] = amor.data.amor_sample_run(608)
101+
res = amor_pipeline.compute(orso.OrsoIofQDataset)
102+
fileio.orso.save_orso(datasets=[res], fname=output_folder / 'amor_reduced_iofq.ort')
103+
104+
94105
@pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation")
95106
@pytest.mark.filterwarnings("ignore:Invalid transformation, missing attribute")
96107
def test_pipeline_can_compute_reflectivity_merging_events_from_multiple_runs(

tests/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# Copyright (c) 2025 Scipp contributors (https://github.com/scipp)
3+
4+
from pathlib import Path
5+
6+
import pytest
7+
8+
9+
def pytest_addoption(parser: pytest.Parser) -> None:
10+
parser.addoption("--file-output", help='Output folder for reduced data')
11+
12+
13+
@pytest.fixture
14+
def output_folder(request: pytest.FixtureRequest) -> Path:
15+
if (path := request.config.getoption("--file-output")) is not None:
16+
out = Path(path)
17+
out.mkdir(parents=True, exist_ok=True)
18+
return out
19+
return request.getfixturevalue("tmp_path")

0 commit comments

Comments
 (0)