1
1
# 3rd party
2
2
import pytest
3
3
from coincidence .selectors import not_pypy
4
+ from domdf_python_tools .paths import PathPlus
4
5
from testing_tox import run_tox
5
6
6
7
7
8
@pytest .fixture ()
8
- def basic_docs_testenv (tmp_pathplus ) :
9
+ def basic_docs_testenv (tmp_pathplus : PathPlus ) -> PathPlus :
9
10
build_dir = tmp_pathplus / "doc-source" / "build"
10
11
build_dir .mkdir (parents = True )
11
12
@@ -19,7 +20,7 @@ def basic_docs_testenv(tmp_pathplus):
19
20
return build_dir
20
21
21
22
22
- def test_rmdir_docs (basic_docs_testenv , tmp_pathplus , capsys ):
23
+ def test_rmdir_docs (basic_docs_testenv : PathPlus , tmp_pathplus : PathPlus , capsys ):
23
24
with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
24
25
fp .write ('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n ' )
25
26
@@ -36,7 +37,7 @@ def test_rmdir_docs(basic_docs_testenv, tmp_pathplus, capsys):
36
37
37
38
38
39
@not_pypy ("mypy does noy support PyPy" )
39
- def test_rmdir_mypy (tmp_pathplus , capsys ):
40
+ def test_rmdir_mypy (tmp_pathplus : PathPlus , capsys ):
40
41
41
42
cache_dir = tmp_pathplus / ".mypy_cache"
42
43
cache_dir .mkdir ()
@@ -60,7 +61,8 @@ def test_rmdir_mypy(tmp_pathplus, capsys):
60
61
assert f"mypy recreate hook: removing { cache_dir } " in stdout
61
62
62
63
63
- def test_simple_custom_hook (basic_docs_testenv , tmp_pathplus , capsys ):
64
+ @pytest .mark .usefixtures ("basic_docs_testenv" )
65
+ def test_simple_custom_hook (tmp_pathplus : PathPlus , capsys ):
64
66
with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
65
67
fp .write ('recreate_hook = "hello world"' )
66
68
@@ -73,7 +75,8 @@ def test_simple_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
73
75
assert f"docs recreate hook: hello world" in stdout
74
76
75
77
76
- def test_custom_hook (basic_docs_testenv , tmp_pathplus , capsys ):
78
+ @pytest .mark .usefixtures ("basic_docs_testenv" )
79
+ def test_custom_hook (tmp_pathplus : PathPlus , capsys ):
77
80
with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
78
81
fp .write ('recreate_hook = custom_hook.custom_hook()\n ' )
79
82
@@ -91,7 +94,8 @@ def test_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
91
94
assert f"docs recreate hook: this is a custom hook" in stdout
92
95
93
96
94
- def test_no_hook (basic_docs_testenv , tmp_pathplus , capsys ):
97
+ @pytest .mark .usefixtures ("basic_docs_testenv" )
98
+ def test_no_hook (tmp_pathplus : PathPlus , capsys ):
95
99
96
100
try :
97
101
run_tox (["-e" , "docs" , "-r" ], tmp_pathplus )
@@ -103,7 +107,7 @@ def test_no_hook(basic_docs_testenv, tmp_pathplus, capsys):
103
107
assert "docs recreate hook: " not in stdout
104
108
105
109
106
- def test_not_recreate (basic_docs_testenv , tmp_pathplus , capsys ):
110
+ def test_not_recreate (basic_docs_testenv : PathPlus , tmp_pathplus : PathPlus , capsys ):
107
111
with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
108
112
fp .write ('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n ' )
109
113
0 commit comments