diff --git a/tests/testComovingCooling.c b/tests/testComovingCooling.c
index 0b3b405c562b13c656cb596b25148bfad0935a5f..b2c7de115acfb712f655eac54c1bf912bee442be 100644
--- a/tests/testComovingCooling.c
+++ b/tests/testComovingCooling.c
@@ -19,11 +19,10 @@
 #include "../config.h"
 
 /* Local headers. */
-#include "../src/cooling/EAGLE/cooling_rates.h"
-#include "../src/cooling/EAGLE/cooling_tables.h"
-#include "../src/cooling/EAGLE/interpolate.h"
 #include "swift.h"
 
+#if defined(CHEMISTRY_EAGLE) && defined(COOLING_EAGLE)
+
 /*
  * @brief Assign particle density and entropy corresponding to the
  * hydrogen number density and internal energy specified.
@@ -235,3 +234,9 @@ int main(int argc, char **argv) {
   free(params);
   return 0;
 }
+
+#else
+
+int main(int argc, char **argv) { return 0; }
+
+#endif
diff --git a/tests/testCooling.c b/tests/testCooling.c
index d0efcb9f3b212b09d0342ccea3040c00eb39f2af..9cf38fc23f74139a0f44dc61ccae6b7c22c77130 100644
--- a/tests/testCooling.c
+++ b/tests/testCooling.c
@@ -19,11 +19,10 @@
 #include "../config.h"
 
 /* Local headers. */
-#include "../src/cooling/EAGLE/cooling_rates.h"
-#include "../src/cooling/EAGLE/cooling_tables.h"
-#include "../src/cooling/EAGLE/interpolate.h"
 #include "swift.h"
 
+#if defined(CHEMISTRY_EAGLE) && defined(COOLING_EAGLE)
+
 /*
  * @brief Assign particle density and entropy corresponding to the
  * hydrogen number density and internal energy specified.
@@ -231,3 +230,9 @@ int main(int argc, char **argv) {
   free(params);
   return 0;
 }
+
+#else
+
+int main(int argc, char **argv) { return 0; }
+
+#endif