diff --git a/.copier-answers.yml b/.copier-answers.yml index e2acb8ed..b2d7f52d 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 101e594 +_commit: a052529 _src_path: gh:scipp/copier_template description: Reflectometry data reduction for the European Spallation Source max_python: '3.12' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8234bc9f..356700a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - uses: pre-commit/action@v3.0.1 with: extra_args: --all-files - - uses: pre-commit-ci/lite-action@v1.0.2 + - uses: pre-commit-ci/lite-action@v1.0.3 if: always() with: msg: Apply automatic formatting diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a5ea2b05..c6a413ea 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -69,7 +69,7 @@ jobs: name: docs_html path: html/ - - uses: JamesIves/github-pages-deploy-action@v4.6.3 + - uses: JamesIves/github-pages-deploy-action@v4.6.4 if: ${{ inputs.publish }} with: branch: gh-pages diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 373ea4a1..e98ed7cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,21 @@ on: type: string jobs: + package-test: + runs-on: ${{ inputs.os-variant }} + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkout_ref }} + - uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + - run: python -m pip install --upgrade pip + - run: python -m pip install . + - run: python tests/package_test.py + name: Run package tests + test: runs-on: ${{ inputs.os-variant }} env: diff --git a/.gitignore b/.gitignore index 46c5ae85..cc2a0f8d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,13 @@ dist html .tox *.egg-info +uv.lock # we lock dependencies with pip-compile, not uv *.sw? # Environments venv +.venv # Caches .clangd/ @@ -39,3 +41,4 @@ docs/generated/ *.cif *.rcif *.ort +*.zip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4442b1b9..e0c499ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-json @@ -14,14 +14,14 @@ repos: args: [ --markdown-linebreak-ext=md ] exclude: '\.svg' - repo: https://github.com/kynan/nbstripout - rev: 0.6.0 + rev: 0.7.1 hooks: - id: nbstripout types: [ "jupyter" ] args: [ "--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.3 + rev: v0.6.2 hooks: - id: ruff args: [ --fix ] @@ -29,7 +29,7 @@ repos: - id: ruff-format types_or: [ python, pyi ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: diff --git a/conda/meta.yaml b/conda/meta.yaml index e0aa9f38..a6e6d095 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -9,6 +9,7 @@ source: {% set pyproject = load_file_data('pyproject.toml') %} {% set dependencies = pyproject.get('project', {}).get('dependencies', {}) %} +{% set test_dependencies = pyproject.get('project', {}).get('optional-dependencies', {}).get('test', {}) %} requirements: @@ -29,8 +30,12 @@ test: - ess.reflectometry - ess.amor requires: - - pytest - - pooch + + {# Conda does not allow spaces between package name and version, so remove them #} + {% for package in test_dependencies %} + - {% if package == "graphviz" %}python-graphviz{% else %}{{ package|replace(" ", "") }}{% endif %} + {% endfor %} + source_files: - pyproject.toml - tests/ diff --git a/docs/conf.py b/docs/conf.py index 87f9a766..ea46cb55 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) + import doctest import os import sys diff --git a/docs/user-guide/amor/compare-to-eos.ipynb b/docs/user-guide/amor/compare-to-eos.ipynb index 2f73722b..a43fb300 100644 --- a/docs/user-guide/amor/compare-to-eos.ipynb +++ b/docs/user-guide/amor/compare-to-eos.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "b97647a4-29ab-45a3-870e-aa49fbddb0c5", + "id": "0", "metadata": {}, "source": [ "# Comparison with PSI reduction software\n", @@ -14,7 +14,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9aaa5e0c-def6-4da5-9f63-b4c72a0de8f1", + "id": "1", "metadata": {}, "outputs": [], "source": [ @@ -31,7 +31,7 @@ }, { "cell_type": "markdown", - "id": "f9f28ab3-b9fd-4cfd-88bd-d290ea5cdf4f", + "id": "2", "metadata": {}, "source": [ "## Recreate reference files using Jochens Amor data reduction software\n", @@ -60,7 +60,7 @@ }, { "cell_type": "markdown", - "id": "a1d7fc35-d958-44ce-83a5-b8d877c47735", + "id": "3", "metadata": {}, "source": [ "## Run essreflectometry on the same files" @@ -69,7 +69,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fccf8385-b2ec-4c14-990f-9083a89f46a2", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -103,7 +103,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a220b29-5115-4594-9c75-ed0f34be74f7", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -132,7 +132,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9311bc67-6edf-4f90-9280-f4bee8df9da3", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -147,7 +147,7 @@ }, { "cell_type": "markdown", - "id": "64b685cb-654e-46a5-9eae-b9bf76dadb8d", + "id": "7", "metadata": {}, "source": [ "## Plot reflectivity curve comparison" @@ -156,7 +156,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8e248ada-0db0-4e9e-a208-64e2ff74c7bb", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -181,7 +181,7 @@ }, { "cell_type": "markdown", - "id": "9d97eff4-77cf-4ea1-8be7-1390bebfcb84", + "id": "9", "metadata": {}, "source": [ "## Overlay curves from same sample at different angle, should be on top of each other" @@ -190,7 +190,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4758e245-c47a-454c-9788-97b05b49f356", + "id": "10", "metadata": {}, "outputs": [], "source": [ diff --git a/pyproject.toml b/pyproject.toml index 97a504b3..49861140 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,11 +39,18 @@ dependencies = [ "sciline>=24.6.0", "scipp>=24.09.1", # Fixed new hist/bin API "scippneutron>=24.7.0", + "scippnexus>=24.9.1", "essreduce", ] dynamic = ["version"] +[project.optional-dependencies] +test = [ + "pytest", + "pooch", +] + [project.urls] "Bug Tracker" = "https://github.com/scipp/essreflectometry/issues" "Documentation" = "https://scipp.github.io/essreflectometry" @@ -65,6 +72,7 @@ filterwarnings = [ "error", 'ignore:\n.*Sentinel is not a public part of the traitlets API.*:DeprecationWarning', "ignore:.*metadata to be logged in the data array, it is necessary to install the orsopy package.:UserWarning", + "ignore:.*A transformation needs a vector attribute. Falling back to returning underlying value.:UserWarning", ] [tool.ruff] @@ -82,8 +90,8 @@ ignore = [ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "COM812", "COM819", "D206", "D300", "E111", "E114", "E117", "ISC001", "ISC002", "Q000", "Q001", "Q002", "Q003", "W191", ] -fixable = ["I001", "B010"] -isort.known-first-party = ["essreflectometry"] +fixable = ["B010", "I001", "PT001"] +isort.known-first-party = ["ess.reflectometry"] pydocstyle.convention = "numpy" [tool.ruff.lint.per-file-ignores] @@ -114,3 +122,11 @@ enable_error_code = [ "truthy-bool", ] warn_unreachable = true + +[tool.codespell] +ignore-words-list = [ + # Codespell wants "socioeconomic" which seems to be the standard spelling. + # But we use the word in our code of conduct which is the contributor covenant. + # Let's not modify it if we don't have to. + "socio-economic", +] diff --git a/requirements/base.in b/requirements/base.in index 55f2b802..d8b4110d 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -11,4 +11,5 @@ orsopy sciline>=24.6.0 scipp>=24.09.1 scippneutron>=24.7.0 +scippnexus>=24.9.1 essreduce diff --git a/requirements/base.txt b/requirements/base.txt index 3b0199a9..4d8a9710 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:c59f85e6dbc38ae7eeef3ce1e4f681c07f43ff24 +# SHA1:3401cd389c29441d88f259ef065f189c2f02bfcb # # This file is autogenerated by pip-compile-multi # To update, run: @@ -19,19 +19,19 @@ cyclebane==24.6.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.8.2 +dask==2024.9.0 # via -r base.in decorator==5.1.1 # via ipython -essreduce==24.9.0 +essreduce==24.9.1 # via -r base.in exceptiongroup==1.2.2 # via ipython executing==2.1.0 # via stack-data -fonttools==4.53.1 +fonttools==4.54.1 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.9.0 # via dask graphviz==0.20.3 # via -r base.in @@ -39,7 +39,7 @@ h5py==3.11.0 # via # scippneutron # scippnexus -importlib-metadata==8.4.0 +importlib-metadata==8.5.0 # via dask ipydatawidgets==4.3.5 # via pythreejs @@ -92,11 +92,11 @@ pexpect==4.9.0 # via ipython pillow==10.4.0 # via matplotlib -plopp==24.6.0 +plopp==24.9.3 # via # -r base.in # scippneutron -prompt-toolkit==3.0.47 +prompt-toolkit==3.0.48 # via ipython ptyprocess==0.7.0 # via pexpect @@ -127,10 +127,11 @@ scipp==24.9.1 # essreduce # scippneutron # scippnexus -scippneutron==24.8.0 +scippneutron==24.9.0 # via -r base.in -scippnexus==24.8.1 +scippnexus==24.9.1 # via + # -r base.in # essreduce # scippneutron scipy==1.14.1 @@ -163,5 +164,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets -zipp==3.20.1 +zipp==3.20.2 # via importlib-metadata diff --git a/requirements/basetest.in b/requirements/basetest.in index 86467f4c..763960e7 100644 --- a/requirements/basetest.in +++ b/requirements/basetest.in @@ -1,5 +1,11 @@ # Dependencies that are only used by tests. # Do not make an environment from this file, use test.txt instead! +# Add more dependencies in the ``test`` list +# under ``[project.optional-dependencies]`` section, in ``pyproject.toml`` +# Anything above "--- END OF CUSTOM SECTION ---" +# will not be touched by ``make_base.py`` +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! pytest pooch diff --git a/requirements/basetest.txt b/requirements/basetest.txt index 5259d8e7..6b41e80e 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -11,7 +11,7 @@ charset-normalizer==3.3.2 # via requests exceptiongroup==1.2.2 # via pytest -idna==3.8 +idna==3.10 # via requests iniconfig==2.0.0 # via pytest @@ -19,17 +19,17 @@ packaging==24.1 # via # pooch # pytest -platformdirs==4.2.2 +platformdirs==4.3.6 # via pooch pluggy==1.5.0 # via pytest pooch==1.8.2 # via -r basetest.in -pytest==8.3.2 +pytest==8.3.3 # via -r basetest.in requests==2.32.3 # via pooch tomli==2.0.1 # via pytest -urllib3==2.2.2 +urllib3==2.2.3 # via requests diff --git a/requirements/ci.txt b/requirements/ci.txt index 07ac45f8..af1677b2 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -17,7 +17,7 @@ colorama==0.4.6 # via tox distlib==0.3.8 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via # tox # virtualenv @@ -25,20 +25,20 @@ gitdb==4.0.11 # via gitpython gitpython==3.1.43 # via -r ci.in -idna==3.8 +idna==3.10 # via requests packaging==24.1 # via # -r ci.in # pyproject-api # tox -platformdirs==4.2.2 +platformdirs==4.3.6 # via # tox # virtualenv pluggy==1.5.0 # via tox -pyproject-api==1.7.1 +pyproject-api==1.8.0 # via tox requests==2.32.3 # via -r ci.in @@ -48,9 +48,9 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.18.0 +tox==4.20.0 # via -r ci.in -urllib3==2.2.2 +urllib3==2.2.3 # via requests -virtualenv==20.26.3 +virtualenv==20.26.5 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 5aad6e79..292820d0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -14,7 +14,7 @@ -r wheels.txt annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.6.0 # via # httpx # jupyter-server @@ -26,7 +26,7 @@ arrow==1.3.0 # via isoduration async-lru==2.0.4 # via jupyterlab -cffi==1.17.0 +cffi==1.17.1 # via argon2-cffi-bindings copier==9.3.1 # via -r dev.in @@ -83,13 +83,13 @@ pip-tools==7.4.1 # via pip-compile-multi plumbum==1.8.3 # via copier -prometheus-client==0.20.0 +prometheus-client==0.21.0 # via jupyter-server pycparser==2.22 # via cffi -pydantic==2.8.2 +pydantic==2.9.2 # via copier -pydantic-core==2.20.1 +pydantic-core==2.23.4 # via pydantic python-json-logger==2.0.7 # via jupyter-events @@ -115,7 +115,7 @@ terminado==0.18.1 # jupyter-server-terminals toposort==1.10 # via pip-compile-multi -types-python-dateutil==2.9.0.20240821 +types-python-dateutil==2.9.0.20240906 # via arrow uri-template==1.3.0 # via jsonschema diff --git a/requirements/docs.txt b/requirements/docs.txt index 266054f3..493a07c7 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -28,7 +28,7 @@ certifi==2024.8.30 # via requests charset-normalizer==3.3.2 # via requests -debugpy==1.8.5 +debugpy==1.8.6 # via ipykernel defusedxml==0.7.1 # via nbconvert @@ -40,7 +40,7 @@ docutils==0.21.2 # sphinx fastjsonschema==2.20.0 # via nbformat -idna==3.8 +idna==3.10 # via requests imagesize==1.4.1 # via sphinx @@ -56,7 +56,7 @@ jsonschema==4.23.0 # via nbformat jsonschema-specifications==2023.12.1 # via jsonschema -jupyter-client==8.6.2 +jupyter-client==8.6.3 # via # ipykernel # nbclient @@ -77,7 +77,7 @@ markupsafe==2.1.5 # via # jinja2 # nbconvert -mdit-py-plugins==0.4.1 +mdit-py-plugins==0.4.2 # via myst-parser mdurl==0.1.2 # via markdown-it-py @@ -100,7 +100,7 @@ nest-asyncio==1.6.0 # via ipykernel pandocfilters==1.5.1 # via nbconvert -platformdirs==4.2.2 +platformdirs==4.3.6 # via # jupyter-core # pooch @@ -139,7 +139,7 @@ sphinx==8.0.2 # sphinx-autodoc-typehints # sphinx-copybutton # sphinx-design -sphinx-autodoc-typehints==2.3.0 +sphinx-autodoc-typehints==2.4.4 # via -r docs.in sphinx-copybutton==0.5.2 # via -r docs.in @@ -165,7 +165,7 @@ tornado==6.4.1 # via # ipykernel # jupyter-client -urllib3==2.2.2 +urllib3==2.2.3 # via requests webencodings==0.5.1 # via diff --git a/requirements/make_base.py b/requirements/make_base.py index 493ede16..ccbab001 100644 --- a/requirements/make_base.py +++ b/requirements/make_base.py @@ -42,8 +42,14 @@ def write_dependencies(dependency_name: str, dependencies: list[str]) -> None: if dependencies is None: raise RuntimeError("No dependencies found in pyproject.toml") dependencies = [dep.strip().strip('"') for dep in dependencies] + test_dependencies = ( + pyproject["project"].get("optional-dependencies", {}).get("test", []) + ) + test_dependencies = [dep.strip().strip('"') for dep in test_dependencies] + write_dependencies("base", dependencies) +write_dependencies("basetest", test_dependencies) def as_nightly(repo: str) -> str: diff --git a/requirements/nightly.txt b/requirements/nightly.txt index c24788f0..544e265c 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -20,17 +20,17 @@ cyclebane==24.6.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.8.2 +dask==2024.9.0 # via -r nightly.in decorator==5.1.1 # via ipython -essreduce==24.9.0 +essreduce==24.9.1 # via -r nightly.in executing==2.1.0 # via stack-data -fonttools==4.53.1 +fonttools==4.54.1 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.9.0 # via dask graphviz==0.20.3 # via -r nightly.in @@ -38,7 +38,7 @@ h5py==3.11.0 # via # scippneutron # scippnexus -importlib-metadata==8.4.0 +importlib-metadata==8.5.0 # via dask ipydatawidgets==4.3.5 # via pythreejs @@ -91,7 +91,7 @@ plopp @ git+https://github.com/scipp/plopp@main # via # -r nightly.in # scippneutron -prompt-toolkit==3.0.47 +prompt-toolkit==3.0.48 # via ipython ptyprocess==0.7.0 # via pexpect @@ -159,5 +159,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets -zipp==3.20.1 +zipp==3.20.2 # via importlib-metadata diff --git a/requirements/static.txt b/requirements/static.txt index 85da246d..d7f3ca42 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -9,17 +9,17 @@ cfgv==3.4.0 # via pre-commit distlib==0.3.8 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via virtualenv -identify==2.6.0 +identify==2.6.1 # via pre-commit nodeenv==1.9.1 # via pre-commit -platformdirs==4.2.2 +platformdirs==4.3.6 # via virtualenv pre-commit==3.8.0 # via -r static.in pyyaml==6.0.2 # via pre-commit -virtualenv==20.26.3 +virtualenv==20.26.5 # via pre-commit diff --git a/requirements/wheels.txt b/requirements/wheels.txt index a1fa46e2..24447442 100644 --- a/requirements/wheels.txt +++ b/requirements/wheels.txt @@ -5,7 +5,7 @@ # # pip-compile-multi # -build==1.2.1 +build==1.2.2 # via -r wheels.in packaging==24.1 # via build diff --git a/src/ess/amor/load.py b/src/ess/amor/load.py index 02bab922..c58f6b90 100644 --- a/src/ess/amor/load.py +++ b/src/ess/amor/load.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import scipp as sc + from ess.reduce import nexus from ..reflectometry.load import load_nx diff --git a/src/ess/amor/utils.py b/src/ess/amor/utils.py index 08510aba..d6f7eb88 100644 --- a/src/ess/amor/utils.py +++ b/src/ess/amor/utils.py @@ -1,4 +1,5 @@ import scipp as sc + from ess.reflectometry.types import ( DetectorRotation, NormalizedIofQ, diff --git a/src/ess/reflectometry/__init__.py b/src/ess/reflectometry/__init__.py index 10ed1b81..d0ec032d 100644 --- a/src/ess/reflectometry/__init__.py +++ b/src/ess/reflectometry/__init__.py @@ -8,7 +8,7 @@ from .load import load_reference, save_reference try: - __version__ = importlib.metadata.version(__package__ or __name__) + __version__ = importlib.metadata.version("essreflectometry") except importlib.metadata.PackageNotFoundError: __version__ = "0.0.0" diff --git a/tests/amor/pipeline_test.py b/tests/amor/pipeline_test.py index fab067e7..cad409da 100644 --- a/tests/amor/pipeline_test.py +++ b/tests/amor/pipeline_test.py @@ -6,6 +6,8 @@ import pytest import sciline import scipp as sc +from orsopy import fileio + from ess import amor from ess.amor import data # noqa: F401 from ess.reflectometry import orso @@ -21,10 +23,9 @@ YIndexLimits, ZIndexLimits, ) -from orsopy import fileio -@pytest.fixture() +@pytest.fixture def amor_pipeline() -> sciline.Pipeline: pl = sciline.Pipeline(providers=amor.providers, params=amor.default_parameters()) pl[SampleSize[SampleRun]] = sc.scalar(10.0, unit="mm") diff --git a/tests/amor/tools_test.py b/tests/amor/tools_test.py index e9d63789..4866a1e7 100644 --- a/tests/amor/tools_test.py +++ b/tests/amor/tools_test.py @@ -3,6 +3,7 @@ # @author Andrew R. McCluskey (arm61) import pytest import scipp as sc + from ess.reflectometry import tools diff --git a/tests/corrections_test.py b/tests/corrections_test.py index 7c3f3338..3e7607cb 100644 --- a/tests/corrections_test.py +++ b/tests/corrections_test.py @@ -1,10 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import scipp as sc -from ess.reflectometry import corrections from scipp import constants as cst from scipp.testing import assert_allclose +from ess.reflectometry import corrections + def test_footprint_correction(): data = sc.DataArray( diff --git a/tests/orso_test.py b/tests/orso_test.py index 6db44bcf..c1f7b484 100644 --- a/tests/orso_test.py +++ b/tests/orso_test.py @@ -3,11 +3,12 @@ from datetime import datetime import sciline +from orsopy import fileio + from ess import amor, reflectometry from ess.amor import data # noqa: F401 from ess.reflectometry import orso from ess.reflectometry.types import Filename, ReferenceRun, SampleRun -from orsopy import fileio def test_build_orso_data_source(): diff --git a/tests/package_test.py b/tests/package_test.py index 6490b190..297b7f62 100644 --- a/tests/package_test.py +++ b/tests/package_test.py @@ -1,7 +1,20 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2024 Scipp contributors (https://github.com/scipp) + +"""Tests of package integrity. + +Note that additional imports need to be added for repositories that +contain multiple packages. +""" + from ess import reflectometry as pkg def test_has_version(): assert hasattr(pkg, '__version__') + + +# This is for CI package tests. They need to run tests with minimal dependencies, +# that is, without installing pytest. This code does not affect pytest. +if __name__ == '__main__': + test_has_version() diff --git a/tests/tools_test.py b/tests/tools_test.py index bf0ea9fe..b447fcf4 100644 --- a/tests/tools_test.py +++ b/tests/tools_test.py @@ -1,9 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import scipp as sc -from ess.reflectometry.tools import combine_curves, scale_reflectivity_curves_to_overlap from scipp.testing import assert_allclose +from ess.reflectometry.tools import combine_curves, scale_reflectivity_curves_to_overlap + def curve(d, qmin, qmax): return sc.DataArray(data=d, coords={'Q': sc.linspace('Q', qmin, qmax, len(d) + 1)})