@@ -15,11 +15,15 @@ def test_project_folder(cookies):
1515 assert project .project .isdir ()
1616
1717
18- def run (args : Sequence [str ], dirpath : os .PathLike ) -> subprocess .CompletedProcess :
18+ def run (args : Sequence [str ], dirpath : os .PathLike , env_bin = None ) -> subprocess .CompletedProcess :
19+ env = os .environ .copy ()
20+ if env_bin :
21+ env ['PATH' ] = os .getcwd () + env_bin + ':' + os .environ .get ('PATH' )
1922 return subprocess .run (args = args ,
2023 stdout = subprocess .PIPE ,
2124 stderr = subprocess .PIPE ,
2225 cwd = dirpath ,
26+ env = env ,
2327 encoding = "utf-8" )
2428
2529
@@ -29,16 +33,16 @@ def baked_with_development_dependencies(cookies):
2933 env_output = run (['python3' , '-m' , 'venv' , 'env' ], result .project )
3034 assert env_output .returncode == 0
3135 env_bin = 'env/Scripts/' if platform .startswith ("win" ) else 'env/bin/'
32- latest_pip_output = run ([f' { env_bin } pip3' , 'install' , '--upgrade' , 'pip' , 'setuptools' ], result .project )
36+ latest_pip_output = run ([' pip3' , 'install' , '--upgrade' , 'pip' , 'setuptools' ], result .project , env_bin )
3337 assert latest_pip_output .returncode == 0
34- pip_output = run ([f' { env_bin } pip3' , 'install' , '--editable' , '.[dev]' ], result .project )
38+ pip_output = run ([' pip3' , 'install' , '--editable' , '.[dev]' ], result .project , env_bin )
3539 assert pip_output .returncode == 0
3640 return result .project , env_bin
3741
3842
3943def test_pytest (baked_with_development_dependencies ):
4044 project_dir , env_bin = baked_with_development_dependencies
41- pytest_output = run ([f' { env_bin } pytest' ], project_dir )
45+ pytest_output = run ([' pytest' ], project_dir , env_bin )
4246 assert pytest_output .returncode == 0
4347 assert '== 3 passed in' in pytest_output .stdout
4448 assert (project_dir / 'coverage.xml' ).exists ()
@@ -55,7 +59,16 @@ def test_subpackage(baked_with_development_dependencies):
5559 subsubpackage .mkdir ()
5660 (subsubpackage / '__init__.py' ).write_text ('FOO = "bar"' , encoding = "utf-8" )
5761
58- build_output = run ([f'{ env_bin } python3' , 'setup.py' , 'build' ], project_dir )
62+ build_output = run ([f'python3' , 'setup.py' , 'build' ], project_dir , env_bin )
5963 assert build_output .returncode == 0
6064 assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / '__init__.py' ).exists ()
6165 assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / 'mysub2' / '__init__.py' ).exists ()
66+
67+
68+ def test_generate_api_docs (baked_with_development_dependencies ):
69+ project_dir , env_bin = baked_with_development_dependencies
70+
71+ docs_dir = project_dir / 'docs'
72+ build_output = run ([f'make' , 'html' ], docs_dir , env_bin )
73+ assert build_output .returncode == 0
74+ assert (docs_dir / '_build' / 'html' / 'index.html' ).exists ()
0 commit comments