File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Licensed under a 3-clause BSD style license - see LICENSE.rst
2+
3+ # Keep the project level fixtures in this file, keeping them in root level
4+ # conftest causes issues with pytest 9.1+
5+
6+ import os
7+ from pathlib import Path
8+
9+ import pytest
10+
11+
12+ @pytest .fixture (scope = 'function' )
13+ def tmp_cwd (tmp_path ):
14+ """Perform test in a pristine temporary working directory."""
15+ old_dir = Path .cwd ()
16+ os .chdir (tmp_path )
17+ try :
18+ yield tmp_path
19+ finally :
20+ os .chdir (old_dir )
Original file line number Diff line number Diff line change 11# Licensed under a 3-clause BSD style license - see LICENSE.rst
22
3- import os
4- from pathlib import Path
3+ # Keep basic config here, so both tox and directly run pytest works as expected.
4+ # Keep the fixtures one layer down for global fixtures and more layer down
5+ # for more specific scopes.
6+
57import sys
68
79from astropy .utils import minversion
@@ -59,17 +61,6 @@ def pytest_addoption(parser):
5961 )
6062
6163
62- @pytest .fixture (scope = 'function' )
63- def tmp_cwd (tmp_path ):
64- """Perform test in a pristine temporary working directory."""
65- old_dir = Path .cwd ()
66- os .chdir (tmp_path )
67- try :
68- yield tmp_path
69- finally :
70- os .chdir (old_dir )
71-
72-
7364def pytest_runtestloop (session ):
7465 if sys .platform == 'win32' :
7566 session .add_marker (pytest .mark .filterwarnings (
You can’t perform that action at this time.
0 commit comments