Skip to content

Commit afa0f2e

Browse files
authored
Merge pull request #882 from effigies/test/doctest_modules
TEST: Enable doctests for pytest
2 parents baab901 + 0a49449 commit afa0f2e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.azure-pipelines/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
mkdir for_testing
115115
cd for_testing
116116
cp ../.coveragerc .
117-
pytest --cov nibabel -v --pyargs nibabel
117+
pytest --doctest-modules --cov nibabel -v --pyargs nibabel
118118
displayName: 'Pytest tests'
119119
condition: and(succeeded(), eq(variables['CHECK_TYPE'], 'test'))
120120
- script: |

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ script:
206206
mkdir for_testing
207207
cd for_testing
208208
cp ../.coveragerc .
209-
pytest --cov nibabel -v --pyargs nibabel
209+
pytest --doctest-modules --cov nibabel -v --pyargs nibabel
210210
else
211211
false
212212
fi

nibabel/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pytest
2+
3+
4+
@pytest.fixture(autouse=True, scope="session")
5+
def set_printopts():
6+
import numpy as np
7+
from distutils.version import LooseVersion
8+
9+
if LooseVersion(np.__version__) >= LooseVersion("1.14"):
10+
legacy_printopt = np.get_printoptions().get("legacy")
11+
np.set_printoptions(legacy="1.13")
12+
yield
13+
np.set_printoptions(legacy=legacy_printopt)
14+
else:
15+
yield

0 commit comments

Comments
 (0)