1
0
python-nibabel/support-pytest-8.patch
Steve Kowalik 2024221375 - Switch to autosetup macro.
- Restrict numpy to < 2 because it isn't currently supported.
- Add patch support-pytest-8.patch:
  * Use pytest setup/teardown methods.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-nibabel?expand=0&rev=24
2024-07-22 05:54:20 +00:00

61 lines
2.0 KiB
Diff

From 82c8588528d5a06fd0dfc99e3cbb83d5cc299e2b Mon Sep 17 00:00:00 2001
From: Sandro <devel@penguinpee.nl>
Date: Wed, 29 May 2024 00:20:34 +0200
Subject: [PATCH] Replace deprecated setup() and teardown()
Those were compatibility functions for porting from nose. They are now
deprecated and have been removed from pytest.
This will make all tests compatible with pytests 8.x.
---
nibabel/streamlines/tests/test_streamlines.py | 2 +-
nibabel/tests/test_deprecated.py | 4 ++--
nibabel/tests/test_dft.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/nibabel/streamlines/tests/test_streamlines.py b/nibabel/streamlines/tests/test_streamlines.py
index f0bd9c7c4..53a43c393 100644
--- a/nibabel/streamlines/tests/test_streamlines.py
+++ b/nibabel/streamlines/tests/test_streamlines.py
@@ -20,7 +20,7 @@
DATA = {}
-def setup():
+def setup_module():
global DATA
DATA['empty_filenames'] = [pjoin(data_path, 'empty' + ext) for ext in FORMATS.keys()]
DATA['simple_filenames'] = [pjoin(data_path, 'simple' + ext) for ext in FORMATS.keys()]
diff --git a/nibabel/tests/test_deprecated.py b/nibabel/tests/test_deprecated.py
index f1c3d517c..01636632e 100644
--- a/nibabel/tests/test_deprecated.py
+++ b/nibabel/tests/test_deprecated.py
@@ -14,12 +14,12 @@
from nibabel.tests.test_deprecator import TestDeprecatorFunc as _TestDF
-def setup():
+def setup_module():
# Hack nibabel version string
pkg_info.cmp_pkg_version.__defaults__ = ('2.0',)
-def teardown():
+def teardown_module():
# Hack nibabel version string back again
pkg_info.cmp_pkg_version.__defaults__ = (pkg_info.__version__,)
diff --git a/nibabel/tests/test_dft.py b/nibabel/tests/test_dft.py
index 654af9827..6c6695b16 100644
--- a/nibabel/tests/test_dft.py
+++ b/nibabel/tests/test_dft.py
@@ -26,7 +26,7 @@
data_dir = pjoin(dirname(__file__), 'data')
-def setUpModule():
+def setup_module():
if os.name == 'nt':
raise unittest.SkipTest('FUSE not available for windows, skipping dft tests')
if not have_dicom: