@@ -178,3 +178,33 @@ def test_docs_build(
178178 assert tox_docs_process .returncode == 0 , (
179179 f"Something went wrong with building docs: { tox_docs_process .stderr !r} "
180180 )
181+
182+
183+ def test_package_tests_tox (
184+ tmp_path : pathlib .Path ,
185+ venv : pytest_venv .VirtualEnvironment ,
186+ generate_package : typing .Callable ,
187+ ) -> None :
188+ """
189+ Test that the package tests pass in all tox environments.
190+
191+ ...and that no warnings are raised (e.g. coverage).
192+ """
193+ config = {
194+ "github_owner" : "test-user" ,
195+ "project_short_description" : "description" ,
196+ "project_name" : "Cookiecutter Test" ,
197+ }
198+ generate_package (config , tmp_path )
199+ test_project_dir = tmp_path / "cookiecutter-test"
200+ venv .install ("tox" )
201+ tox_multienv_test_process = subprocess .run ( # noqa: S603
202+ [pathlib .Path (venv .bin ) / "tox" ],
203+ check = False ,
204+ cwd = test_project_dir ,
205+ capture_output = True ,
206+ )
207+ tests_pass = tox_multienv_test_process .returncode == 0
208+ assert tests_pass , "Template tests failed in one or more tox environments."
209+ output = tox_multienv_test_process .stdout .decode ()
210+ assert "WARNING:" not in output , f"Warnings raised during tests: { output } "
0 commit comments