99import spack .builder
1010import spack .main
1111
12- # the command we’re testing
13- compile_commands = spack .main .SpackCommand ("compile-commands" )
12+ manager = spack .main .SpackCommand ("manager" )
1413
1514
1615class DummyPkg :
@@ -63,7 +62,7 @@ def mock_environment_and_package(tmp_path, monkeypatch):
6362
6463def test_compile_commands_copies_file (mock_environment_and_package ):
6564 pkg , cc_in = mock_environment_and_package
66- compile_commands ( "--serial" )
65+ manager ( "compile-commands" , "--serial" )
6766 dest = os .path .join (pkg .stage .source_path , "bar" , "compile_commands.json" )
6867 assert os .path .exists (dest )
6968
@@ -79,7 +78,7 @@ def test_compile_commands_symlink_replacement(mock_environment_and_package):
7978
8079 # create a symlink at the destination
8180 os .symlink ("/some/other/path" , dest )
82- compile_commands ( "--serial" )
81+ manager ( "compile-commands" , "--serial" )
8382
8483 assert os .path .exists (dest )
8584 assert not os .path .islink (dest )
@@ -106,7 +105,7 @@ def test_compile_commands_no_source_file(tmp_path, monkeypatch):
106105 monkeypatch .setattr (spack .environment , "active_environment" , lambda : fake_env )
107106 monkeypatch .setattr (spack .builder , "create" , lambda pkg : DummyBuilder ("build_dir" ))
108107
109- compile_commands ( "--serial" )
108+ manager ( "compile-commands" , "--serial" )
110109 dest = os .path .join (pkg .stage .source_path , "bar" , "compile_commands.json" )
111110 assert not os .path .exists (dest )
112111
@@ -117,7 +116,7 @@ def test_compile_commands_no_root_cmakelists_dir(mock_environment_and_package):
117116 if hasattr (pkg , "root_cmakelists_dir" ):
118117 del pkg .root_cmakelists_dir
119118
120- compile_commands ( "--serial" )
119+ manager ( "compile-commands" , "--serial" )
121120 dest = os .path .join (pkg .stage .source_path , "compile_commands.json" )
122121 assert os .path .exists (dest )
123122
@@ -185,7 +184,7 @@ def two_pkg_env(tmp_path, monkeypatch):
185184
186185def test_strip_isystem_and_inject_I (two_pkg_env ):
187186 pkg_foo , pkg_bar = two_pkg_env
188- compile_commands ( "--serial" )
187+ manager ( "compile-commands" , "--serial" )
189188
190189 # foo’s file unchanged (except no -isystem):
191190 foo_dst = os .path .join (pkg_foo .stage .source_path , "compile_commands.json" )
@@ -258,7 +257,7 @@ def test_no_cross_inject_when_no_isystem(tmp_path, monkeypatch):
258257 monkeypatch .setattr (spack .environment , "active_environment" , lambda : fake_env )
259258 monkeypatch .setattr (spack .builder , "create" , lambda pkg : DummyBuilder ("build_dir" ))
260259
261- compile_commands ( "--serial" )
260+ manager ( "compile-commands" , "--serial" )
262261
263262 for pkg in (pkg1 , pkg2 ):
264263 dst = os .path .join (pkg .stage .source_path , "compile_commands.json" )
0 commit comments