Skip to content

Commit 60a581a

Browse files
committed
Update support to newer python versions
1 parent 9858e22 commit 60a581a

File tree

5 files changed

+811
-343
lines changed

5 files changed

+811
-343
lines changed

phys2bids/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
from . import _version
99

1010
__version__ = _version.get_versions()["version"]
11+
12+
from . import _version
13+
14+
__version__ = _version.get_versions()["version"]

phys2bids/tests/test_bids.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22
from csv import reader
3+
from importlib import resources
34

45
import pytest
56
import yaml
6-
from pkg_resources import resource_filename
77

88
from phys2bids import bids
99
from phys2bids.bids import UNIT_ALIASES
@@ -34,12 +34,14 @@ def test_bidsify_units():
3434
@pytest.mark.parametrize("test_sub", ["SBJ01", "sub-006", "006"])
3535
@pytest.mark.parametrize("test_ses", ["", "S05", "ses-42", "42"])
3636
def test_use_heuristic(tmpdir, test_sub, test_ses):
37-
test_heur_path = resource_filename("phys2bids", "heuristics")
38-
test_heur_file = "heur_test_acq.py"
39-
test_full_heur_path = os.path.join(test_heur_path, test_heur_file)
40-
test_input_path = resource_filename("phys2bids", "tests/data")
41-
test_input_file = "Test_belt_pulse_samefreq.acq"
42-
test_full_input_path = os.path.join(test_input_path, test_input_file)
37+
ref = resources.files("phys2bids") / "heuristics"
38+
with resources.as_file(ref) as test_heur_path:
39+
test_heur_file = "heur_test_acq.py"
40+
test_full_heur_path = os.path.join(test_heur_path, test_heur_file)
41+
ref = resources.files("phys2bids") / "tests/data"
42+
with resources.as_file(ref) as test_input_path:
43+
test_input_file = "Test_belt_pulse_samefreq.acq"
44+
test_full_input_path = os.path.join(test_input_path, test_input_file)
4345
test_outdir = tmpdir
4446
test_record_label = "test"
4547

phys2bids/tests/test_integration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import re
55
import shutil
66
import subprocess
7+
from importlib import resources
78
from os import remove
89
from os.path import isfile, join, split
910

1011
import pytest
11-
from pkg_resources import resource_filename
1212

1313
from phys2bids._version import get_versions
1414
from phys2bids.phys2bids import phys2bids
@@ -109,8 +109,9 @@ def test_integration_heuristic(skip_integration, multifreq_lab_file):
109109
test_ntp = 30
110110
test_tr = 1.2
111111
test_thr = 0.735
112-
heur_path = resource_filename("phys2bids", "heuristics")
113-
test_heur = join(heur_path, "heur_test_multifreq.py")
112+
ref = resources.files("phys2bids") / "heuristics"
113+
with resources.as_file(ref) as heur_path:
114+
test_heur = join(heur_path, "heur_test_multifreq.py")
114115

115116
# Move into folder
116117
subprocess.run(f"cd {test_path}", shell=True, check=True)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ provides =
2525
[options]
2626
python_requires = >=3.6.1
2727
install_requires =
28-
numpy >=1.10, <1.24
28+
numpy >=1.10
2929
matplotlib >=3.1.1, !=3.3.0rc1
3030
PyYAML >=5.1
3131
tests_require =

0 commit comments

Comments
 (0)