File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 22import numpy
33import os
44
5+ DATADIR = os .path .realpath (
6+ os .path .join (os .path .dirname (__file__ ), 'testing/data' ))
7+
58
69@pytest .fixture (autouse = True )
710def add_np (doctest_namespace ):
811 doctest_namespace ['np' ] = numpy
912 doctest_namespace ['os' ] = os
1013
11- filepath = os .path .dirname (os .path .realpath (__file__ ))
12- datadir = os .path .realpath (os .path .join (filepath , 'testing/data' ))
13- doctest_namespace ["datadir" ] = datadir
14+ doctest_namespace ["datadir" ] = DATADIR
1415
1516
16- @pytest .fixture (scope = 'session' , autouse = True )
17- def in_testing ():
18- datadir = os .path .realpath (
19- os .path .join (os .path .dirname (__file__ ), 'testing/data' ))
20- origdir = os .getcwd ()
21- os .chdir (datadir )
22- yield
23- os .chdir (origdir )
17+ @pytest .fixture (autouse = True )
18+ def in_testing (request ):
19+ # This seems to be a reliable way to distinguish tests from doctests
20+ if request .function is None :
21+ os .chdir (DATADIR )
You can’t perform that action at this time.
0 commit comments