@@ -154,7 +154,10 @@ def test_failing_test(tmp_path):
154154 assert len (os .listdir (output_dir )) == 0
155155
156156
157- def test_bare_pytest_invocation (tmp_path : Path , capfd : pytest .CaptureFixture [str ]):
157+ @pytest .mark .parametrize ("test_runner" , ["pytest" , "unittest" ])
158+ def test_bare_pytest_invocation (
159+ tmp_path : Path , capfd : pytest .CaptureFixture [str ], test_runner : str
160+ ):
158161 """Check that if a user runs pytest in the the test cwd, it raises a helpful error"""
159162 project_dir = tmp_path / "project"
160163 output_dir = tmp_path / "output"
@@ -165,8 +168,10 @@ def test_bare_pytest_invocation(tmp_path: Path, capfd: pytest.CaptureFixture[str
165168 project_dir ,
166169 output_dir = output_dir ,
167170 add_env = {
168- "CIBW_TEST_REQUIRES" : "pytest" ,
169- "CIBW_TEST_COMMAND" : "python -m pytest" ,
171+ "CIBW_TEST_REQUIRES" : "pytest" if test_runner == "pytest" else "" ,
172+ "CIBW_TEST_COMMAND" : (
173+ "python -m pytest" if test_runner == "pytest" else "python -m unittest"
174+ ),
170175 # Skip CPython 3.8 on macOS arm64, see comment above in
171176 # 'test_failing_test'
172177 "CIBW_SKIP" : "cp38-macosx_arm64" ,
@@ -179,5 +184,5 @@ def test_bare_pytest_invocation(tmp_path: Path, capfd: pytest.CaptureFixture[str
179184
180185 assert (
181186 "Please specify a path to your tests when invoking pytest using the {project} placeholder"
182- in captured .out
187+ in captured .out + captured . err
183188 )
0 commit comments