Skip to content

Commit dae2f86

Browse files
committed
TEST: Check import-time warnings on modules via conftest
1 parent 27146c6 commit dae2f86

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

nibabel/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
3+
# Pre-load deprecated modules to avoid cluttering warnings
4+
with pytest.deprecated_call():
5+
import nibabel.keywordonly
6+
with pytest.deprecated_call():
7+
import nibabel.trackvis
8+
with pytest.warns(FutureWarning):
9+
import nibabel.py3k
10+
11+
# Ignore warning requesting help with nicom
12+
with pytest.warns(UserWarning):
13+
import nibabel.nicom

nibabel/keywordonly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from functools import wraps
55
import warnings
66

7-
warnings.warn("We will remove this module from nibabel 5.0. "
7+
warnings.warn("We will remove the 'keywordonly' module from nibabel 5.0. "
88
"Please use the built-in Python `*` argument to ensure "
99
"keyword-only parameters (see PEP 3102).",
1010
DeprecationWarning,

0 commit comments

Comments
 (0)