diff --git a/src/utils/Stop.cpp b/src/utils/Stop.cpp
index c789beb3a848afcabf8cd21e0b6e85879e1a7407..593094cc311a8d1d72ed687d9a90d3af65f1c881 100644
--- a/src/utils/Stop.cpp
+++ b/src/utils/Stop.cpp
@@ -30,6 +30,7 @@ stop()
     }
 
 #ifdef PUGS_HAS_SLURM
+    // LCOV_EXCL_START
     char* env = getenv("SLURM_JOB_ID");
     if (env != nullptr) {
       slurm_init(nullptr);
@@ -41,6 +42,7 @@ stop()
 
       slurm_fini();
     }
+    // LCOV_EXCL_STOP
 #endif   // PUGS_HAS_SLURM
   }
 
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 5b7ff6b0660b7076ebeb0cd9b7b7debf99462310..87cac19205c7eece3918e7d2e076d6ba4e79f74f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -147,6 +147,7 @@ add_executable (unit_tests
   test_SourceLocation.cpp
   test_SquareGaussQuadrature.cpp
   test_SquareTransformation.cpp
+  test_Stop.cpp
   test_SymbolTable.cpp
   test_Table.cpp
   test_TetrahedronGaussQuadrature.cpp
diff --git a/tests/test_Stop.cpp b/tests/test_Stop.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4e5d62049c6353119358ffe3b073c127a62b5dbc
--- /dev/null
+++ b/tests/test_Stop.cpp
@@ -0,0 +1,36 @@
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/matchers/catch_matchers_all.hpp>
+
+#include <utils/ExecutionStatManager.hpp>
+#include <utils/Stop.hpp>
+
+#include <chrono>
+#include <filesystem>
+#include <fstream>
+
+// clazy:excludeall=non-pod-global-static
+
+TEST_CASE("Stop", "[utils]")
+{
+  ExecutionStatManager::create();
+  auto stop_file = std::filesystem::current_path() / "stop";
+  std::filesystem::remove(stop_file);
+
+  REQUIRE(not std::filesystem::exists(stop_file));
+  REQUIRE(not stop());
+
+  std::ofstream{stop_file.c_str()}.put('a');
+  REQUIRE(std::filesystem::exists(stop_file));
+
+  std::filesystem::file_time_type ftime = std::filesystem::last_write_time(stop_file);
+
+  using namespace std::chrono_literals;
+  std::filesystem::last_write_time(stop_file, ftime - 1h);
+
+  REQUIRE(not stop());
+
+  std::filesystem::last_write_time(stop_file, ftime);
+  REQUIRE(stop());
+
+  ExecutionStatManager::destroy();
+}