Skip to content

Commit d90e8a0

Browse files
committed
MNT: Drop labeled pre-Py3.7 compatibility hacks
1 parent c855dc7 commit d90e8a0

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

nibabel/testing/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from itertools import zip_longest
2626

27-
try:
28-
from contextlib import nullcontext
29-
except ImportError: # PY36
30-
from contextlib import contextmanager
31-
@contextmanager
32-
def nullcontext():
33-
yield
27+
from contextlib import nullcontext
3428

3529

3630
def test_data(subdir=None, fname=None):

nibabel/tests/test_loadsave.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def test_read_img_data():
3636
]
3737
fnames_test += [pathlib.Path(p) for p in fnames_test]
3838
for fname in fnames_test:
39-
# os.path.join doesn't work between str / os.PathLike in py3.5
40-
fpath = pjoin(data_path, str(fname))
39+
fpath = pjoin(data_path, fname)
4140
if isinstance(fname, pathlib.Path):
4241
fpath = pathlib.Path(fpath)
4342
img = load(fpath)
@@ -56,8 +55,7 @@ def test_read_img_data():
5655
up_fpath = pjoin(tmpdir, str(fname).upper())
5756
if isinstance(fname, pathlib.Path):
5857
up_fpath = pathlib.Path(up_fpath)
59-
# shutil doesn't work with os.PathLike in py3.5
60-
shutil.copyfile(str(fpath), str(up_fpath))
58+
shutil.copyfile(fpath, up_fpath)
6159
img = load(up_fpath)
6260
assert_array_equal(img.dataobj, data)
6361
del img

0 commit comments

Comments
 (0)