We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60c3afb commit 07289b7Copy full SHA for 07289b7
nibabel/externals/conftest.py
@@ -0,0 +1,25 @@
1
+import pytest
2
+
3
+try:
4
+ from contextlib import chdir as _chdir
5
+except ImportError: # PY310
6
+ import os
7
+ from contextlib import contextmanager
8
9
+ @contextmanager # type: ignore
10
+ def _chdir(path):
11
+ cwd = os.getcwd()
12
+ os.chdir(path)
13
+ try:
14
+ yield
15
+ finally:
16
+ os.chdir(cwd)
17
18
19
+@pytest.fixture(autouse=True)
20
+def chdir_tmpdir(request, tmp_path):
21
+ if request.node.__class__.__name__ == "DoctestItem":
22
+ with _chdir(tmp_path):
23
24
+ else:
25
0 commit comments