@@ -15,16 +15,15 @@ def test_project_folder(cookies):
1515 assert project .project .isdir ()
1616
1717
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' )
22- return subprocess .run (args = args ,
18+ def run (args : Sequence [str ], dirpath : os .PathLike ) -> subprocess .CompletedProcess :
19+ completed_process = subprocess .run (args = args ,
2320 stdout = subprocess .PIPE ,
2421 stderr = subprocess .PIPE ,
2522 cwd = dirpath ,
26- env = env ,
2723 encoding = "utf-8" )
24+ print (completed_process .stdout )
25+ print (completed_process .stderr )
26+ return completed_process
2827
2928
3029@pytest .fixture
@@ -33,16 +32,16 @@ def baked_with_development_dependencies(cookies):
3332 env_output = run (['python3' , '-m' , 'venv' , 'env' ], result .project )
3433 assert env_output .returncode == 0
3534 env_bin = 'env/Scripts/' if platform .startswith ("win" ) else 'env/bin/'
36- latest_pip_output = run ([' pip3' , 'install' , '--upgrade' , 'pip' , 'setuptools' ], result .project , env_bin )
35+ latest_pip_output = run ([f' { env_bin } pip3' , 'install' , '--upgrade' , 'pip' , 'setuptools' ], result .project )
3736 assert latest_pip_output .returncode == 0
38- pip_output = run ([' pip3' , 'install' , '--editable' , '.[dev]' ], result .project , env_bin )
37+ pip_output = run ([f' { env_bin } pip3' , 'install' , '--editable' , '.[dev]' ], result .project )
3938 assert pip_output .returncode == 0
4039 return result .project , env_bin
4140
4241
4342def test_pytest (baked_with_development_dependencies ):
4443 project_dir , env_bin = baked_with_development_dependencies
45- pytest_output = run ([' pytest' ], project_dir , env_bin )
44+ pytest_output = run ([f' { env_bin } pytest' ], project_dir )
4645 assert pytest_output .returncode == 0
4746 assert '== 3 passed in' in pytest_output .stdout
4847 assert (project_dir / 'coverage.xml' ).exists ()
@@ -59,7 +58,7 @@ def test_subpackage(baked_with_development_dependencies):
5958 subsubpackage .mkdir ()
6059 (subsubpackage / '__init__.py' ).write_text ('FOO = "bar"' , encoding = "utf-8" )
6160
62- build_output = run ([f'python3 ' , 'setup.py' , 'build' ], project_dir , env_bin )
61+ build_output = run ([f'{ env_bin } python ' , 'setup.py' , 'build' ], project_dir )
6362 assert build_output .returncode == 0
6463 assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / '__init__.py' ).exists ()
6564 assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / 'mysub2' / '__init__.py' ).exists ()
@@ -68,7 +67,6 @@ def test_subpackage(baked_with_development_dependencies):
6867def test_generate_api_docs (baked_with_development_dependencies ):
6968 project_dir , env_bin = baked_with_development_dependencies
7069
71- docs_dir = project_dir / 'docs'
72- build_output = run ([f'make' , 'html' ], docs_dir , env_bin )
70+ build_output = run ([f'{ env_bin } sphinx-build' , '-b' , 'html' , 'docs' , 'docs/_build/html' ], project_dir )
7371 assert build_output .returncode == 0
74- assert (docs_dir / '_build' / 'html' / 'index.html' ).exists ()
72+ assert (project_dir / 'docs' / '_build' / 'html' / 'index.html' ).exists ()
0 commit comments