Skip to content

Commit fa88367

Browse files
Refactor function fixture as parametrize
Such that its name can be more informative.
1 parent 5bcb2ff commit fa88367

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/link/c/test_cmodule.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,19 @@ def cxx_search_dirs(blas_libs, mock_system):
228228
)
229229

230230

231-
@pytest.fixture(
232-
scope="function", params=[True, False], ids=["Working_CXX", "Broken_CXX"]
231+
@pytest.mark.parametrize(
232+
"working_cxx", [True, False], ids=["Working_CXX", "Broken_CXX"]
233233
)
234-
def cxx_search_dirs_status(request):
235-
return request.param
236-
237-
238234
@patch("pytensor.link.c.cmodule.std_lib_dirs", return_value=[])
239235
@patch("pytensor.link.c.cmodule.check_mkl_openmp", return_value=None)
240236
def test_default_blas_ldflags(
241-
mock_std_lib_dirs, mock_check_mkl_openmp, cxx_search_dirs, cxx_search_dirs_status
237+
mock_std_lib_dirs, mock_check_mkl_openmp, cxx_search_dirs, working_cxx
242238
):
243239
cxx_search_dirs, expected_blas_ldflags, enabled_accelerate_framework = (
244240
cxx_search_dirs
245241
)
246242
mock_process = MagicMock()
247-
if cxx_search_dirs_status:
243+
if working_cxx:
248244
error_message = ""
249245
mock_process.communicate = lambda *args, **kwargs: (cxx_search_dirs, b"")
250246
mock_process.returncode = 0
@@ -273,7 +269,7 @@ def wrapped(test_code, tmp_prefix, flags, try_run, output):
273269
"try_compile_tmp",
274270
new_callable=patched_compile_tmp,
275271
):
276-
if cxx_search_dirs_status:
272+
if working_cxx:
277273
assert set(default_blas_ldflags().split(" ")) == set(
278274
expected_blas_ldflags.split(" ")
279275
)

0 commit comments

Comments
 (0)