|
1 | 1 | import os |
2 | 2 | from csv import reader |
| 3 | +from importlib import resources |
3 | 4 |
|
4 | 5 | import pytest |
5 | 6 | import yaml |
6 | | -from pkg_resources import resource_filename |
7 | 7 |
|
8 | 8 | from phys2bids import bids |
9 | 9 | from phys2bids.bids import UNIT_ALIASES |
@@ -34,12 +34,14 @@ def test_bidsify_units(): |
34 | 34 | @pytest.mark.parametrize("test_sub", ["SBJ01", "sub-006", "006"]) |
35 | 35 | @pytest.mark.parametrize("test_ses", ["", "S05", "ses-42", "42"]) |
36 | 36 | 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) |
43 | 45 | test_outdir = tmpdir |
44 | 46 | test_record_label = "test" |
45 | 47 |
|
|
0 commit comments