Skip to content

Commit

Permalink
FIX: Remove dead code paths identified by coverage, add PY310 tag
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 8, 2024
1 parent 434dd07 commit f89e319
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
5 changes: 1 addition & 4 deletions nibabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ def bench(label=None, verbose=1, extra_argv=None):
code : ExitCode
Returns the result of running the tests as a ``pytest.ExitCode`` enum
"""
try:
from importlib.resources import as_file, files
except ImportError:
from importlib_resources import as_file, files
from importlib.resources import as_file, files

args = []
if extra_argv is not None:
Expand Down
7 changes: 2 additions & 5 deletions nibabel/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

@pytest.fixture(scope='session', autouse=True)
def legacy_printoptions():
from packaging.version import Version

if Version(np.__version__) >= Version('1.22'):
np.set_printoptions(legacy='1.21')
np.set_printoptions(legacy='1.21')


@pytest.fixture
Expand All @@ -24,7 +21,7 @@ def max_digits():
orig_max_str_digits = sys.get_int_max_str_digits()
yield sys.set_int_max_str_digits
sys.set_int_max_str_digits(orig_max_str_digits)
except AttributeError: # pragma: no cover
except AttributeError: # PY310 # pragma: no cover
# Nothing to do for versions of Python that lack these methods
# They were added as DoS protection in Python 3.11 and backported to
# some other versions.
Expand Down
6 changes: 1 addition & 5 deletions nibabel/tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import pathlib
import unittest
from importlib.resources import files
from unittest import mock

import pytest

try:
from importlib.resources import files
except ImportError:
from importlib_resources import files

import nibabel as nib


Expand Down

0 comments on commit f89e319

Please sign in to comment.