From cbbfcf444408b0fd31b327ca6008977f5f458c27 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Wynen Date: Fri, 26 Jan 2024 15:18:41 +0100 Subject: [PATCH 1/3] Remove SCIPPDIR env variable --- tests/conftest.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index d446b30e..08cfd468 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,14 +2,11 @@ # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import os -from pathlib import Path from typing import Any, List import pytest import scipp as sc -# Load the config file in the test dir instead of the user's. -os.environ['SCIPPDIR'] = os.fspath(Path(__file__).resolve().parent) # Silence warning from Jupyter os.environ['JUPYTER_PLATFORM_DIRS'] = '1' From 1203ab5609f77ffc79d47b7e1075ab15739aac51 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Wynen Date: Fri, 26 Jan 2024 15:34:15 +0100 Subject: [PATCH 2/3] Use import-mode=importlib --- pyproject.toml | 1 + tests/conftest.py | 4 ++++ tests/load_files_test.py | 3 +-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 08e11c1f..8945f9d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ minversion = "7.0" addopts = """ --strict-config --strict-markers +--import-mode=importlib -ra -v -m 'not externalfile' diff --git a/tests/conftest.py b/tests/conftest.py index 08cfd468..5a857913 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,8 @@ # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import os +import sys +from pathlib import Path from typing import Any, List import pytest @@ -9,6 +11,8 @@ # Silence warning from Jupyter os.environ['JUPYTER_PLATFORM_DIRS'] = '1' +# To import helper modules +sys.path.insert(0, str(Path(__file__).resolve().parent)) pytest.register_assert_rewrite('scipp.testing.assertions') diff --git a/tests/load_files_test.py b/tests/load_files_test.py index e2fc9bd5..2d661c0c 100644 --- a/tests/load_files_test.py +++ b/tests/load_files_test.py @@ -2,13 +2,12 @@ # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) from typing import Any, Dict, Optional, Union +import externalfile import pytest import scipp as sc import scippnexus as snx -externalfile = pytest.importorskip('externalfile') - all_files = [ '2023/DREAM_baseline_all_dets.nxs', '2023/BIFROST_873855_00000015.hdf', From 14d9df6e9ac5557efa8d40b049dad778099acadb Mon Sep 17 00:00:00 2001 From: Jan-Lukas Wynen Date: Fri, 26 Jan 2024 15:50:13 +0100 Subject: [PATCH 3/3] Revert to use importskip --- tests/load_files_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/load_files_test.py b/tests/load_files_test.py index 2d661c0c..e2fc9bd5 100644 --- a/tests/load_files_test.py +++ b/tests/load_files_test.py @@ -2,12 +2,13 @@ # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) from typing import Any, Dict, Optional, Union -import externalfile import pytest import scipp as sc import scippnexus as snx +externalfile = pytest.importorskip('externalfile') + all_files = [ '2023/DREAM_baseline_all_dets.nxs', '2023/BIFROST_873855_00000015.hdf',