File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from shutil import copytree
3
2
4
3
import pytest
5
4
5
+ from .tests .data import load
6
+
6
7
try :
7
8
from contextlib import chdir as _chdir
8
9
except ImportError : # PY310
@@ -19,17 +20,19 @@ def _chdir(path):
19
20
os .chdir (cwd )
20
21
21
22
22
- @pytest .fixture ( scope = 'module' )
23
+ @pytest .fixture
23
24
def data_dir ():
24
- return Path (__file__ ).parent / 'tests' / 'data'
25
+ with load .as_path () as data_dir :
26
+ yield data_dir
25
27
26
28
27
29
@pytest .fixture (autouse = True )
28
30
def _docdir (request , tmp_path ):
29
31
# Trigger ONLY for the doctests.
30
32
doctest_plugin = request .config .pluginmanager .getplugin ('doctest' )
31
33
if isinstance (request .node , doctest_plugin .DoctestItem ):
32
- copytree (Path (__file__ ).parent / 'tests' / 'data' , tmp_path , dirs_exist_ok = True )
34
+ with load .as_path () as data_dir :
35
+ copytree (data_dir , tmp_path , dirs_exist_ok = True )
33
36
34
37
# Chdir only for the duration of the test.
35
38
with _chdir (tmp_path ):
Original file line number Diff line number Diff line change
1
+ from acres import Loader
2
+
3
+ load = Loader (__spec__ .name )
You can’t perform that action at this time.
0 commit comments