11# 3rd party
22import pytest
33from coincidence .selectors import not_pypy
4+ from domdf_python_tools .paths import PathPlus
45from testing_tox import run_tox
56
67
78@pytest .fixture ()
8- def basic_docs_testenv (tmp_pathplus ) :
9+ def basic_docs_testenv (tmp_pathplus : PathPlus ) -> PathPlus :
910 build_dir = tmp_pathplus / "doc-source" / "build"
1011 build_dir .mkdir (parents = True )
1112
@@ -19,7 +20,7 @@ def basic_docs_testenv(tmp_pathplus):
1920 return build_dir
2021
2122
22- def test_rmdir_docs (basic_docs_testenv , tmp_pathplus , capsys ):
23+ def test_rmdir_docs (basic_docs_testenv : PathPlus , tmp_pathplus : PathPlus , capsys ):
2324 with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
2425 fp .write ('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n ' )
2526
@@ -36,7 +37,7 @@ def test_rmdir_docs(basic_docs_testenv, tmp_pathplus, capsys):
3637
3738
3839@not_pypy ("mypy does noy support PyPy" )
39- def test_rmdir_mypy (tmp_pathplus , capsys ):
40+ def test_rmdir_mypy (tmp_pathplus : PathPlus , capsys ):
4041
4142 cache_dir = tmp_pathplus / ".mypy_cache"
4243 cache_dir .mkdir ()
@@ -60,7 +61,8 @@ def test_rmdir_mypy(tmp_pathplus, capsys):
6061 assert f"mypy recreate hook: removing { cache_dir } " in stdout
6162
6263
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 ):
6466 with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
6567 fp .write ('recreate_hook = "hello world"' )
6668
@@ -73,7 +75,8 @@ def test_simple_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
7375 assert f"docs recreate hook: hello world" in stdout
7476
7577
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 ):
7780 with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
7881 fp .write ('recreate_hook = custom_hook.custom_hook()\n ' )
7982
@@ -91,7 +94,8 @@ def test_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
9194 assert f"docs recreate hook: this is a custom hook" in stdout
9295
9396
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 ):
9599
96100 try :
97101 run_tox (["-e" , "docs" , "-r" ], tmp_pathplus )
@@ -103,7 +107,7 @@ def test_no_hook(basic_docs_testenv, tmp_pathplus, capsys):
103107 assert "docs recreate hook: " not in stdout
104108
105109
106- def test_not_recreate (basic_docs_testenv , tmp_pathplus , capsys ):
110+ def test_not_recreate (basic_docs_testenv : PathPlus , tmp_pathplus : PathPlus , capsys ):
107111 with (tmp_pathplus / "tox.ini" ).open ('a' ) as fp :
108112 fp .write ('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n ' )
109113
0 commit comments