diff --git a/software/caddy-frontend/test/test.py b/software/caddy-frontend/test/test.py
index 31b7cc2b888342ed47395658b9b5c80116633a2c..fb62fc7b4a2d20780d27129e8248c00e52c83042 100644
--- a/software/caddy-frontend/test/test.py
+++ b/software/caddy-frontend/test/test.py
@@ -480,8 +480,8 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
 
   @classmethod
   def stopServerProcess(cls):
-    if getattr(cls, 'test_server_certificate_file', None) is None:
-      os.unlink(cls.test_server_certificate_file)
+    if getattr(cls, 'test_server_certificate_file', None) is not None:
+      os.unlink(cls.test_server_certificate_file.name)
     if getattr(cls, 'server_process', None) is None:
       return
     cls.server_process.terminate()