File tree 1 file changed +16
-6
lines changed
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change
1
+ import pathlib
1
2
import shutil
2
3
4
+ import sphinx
3
5
import pytest
4
- from sphinx .testing import path
5
6
6
7
# this is necessary because Sphinx isn't exposing its fixtures
7
8
# https://docs.pytest.org/en/7.1.x/how-to/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file
8
9
pytest_plugins = ['sphinx.testing.fixtures' ]
9
10
10
11
12
+ # TODO: Remove when we no longer care about Sphinx < 7.2
11
13
@pytest .fixture
12
14
def rootdir (tmpdir ):
13
- src = path .path (__file__ ).parent .abspath () / 'roots'
14
- dst = tmpdir .join ('roots' )
15
- shutil .copytree (src , dst )
16
- roots = path .path (dst )
17
- print (dst )
15
+ if sphinx .version_info >= (7 , 2 , 0 ):
16
+ src = pathlib .Path (__file__ ).parent .absolute ().joinpath ('roots' )
17
+ dst = tmpdir .join ('roots' )
18
+ shutil .copytree (src , dst )
19
+ roots = pathlib .Path (dst )
20
+ else :
21
+ from sphinx .testing import path
22
+
23
+ src = path .path (__file__ ).parent .abspath () / 'roots'
24
+ dst = tmpdir .join ('roots' )
25
+ shutil .copytree (src , dst )
26
+ roots = path .path (dst )
27
+
18
28
yield roots
19
29
shutil .rmtree (dst )
You can’t perform that action at this time.
0 commit comments