Fail selftest if anything is written to stderr
[mudpy.git] / mudpy / tests / selftest.py
index c0bfc3c..f8caf35 100644 (file)
@@ -519,6 +519,13 @@ def stop_service(service):
     with open("capture_stderr.log", "w") as serviceerr:
         serviceerr.write(stderr.decode("utf-8"))
 
     with open("capture_stderr.log", "w") as serviceerr:
         serviceerr.write(stderr.decode("utf-8"))
 
+    # Error if anything was written on stderr as this may indicate ignored
+    # exceptions (e.g. ResourceWarning during garbage collection)
+    if stderr:
+        tlog("\nERROR: something was written to stderr, see "
+             "capture_stderr.log for details.")
+        success = False
+
     return success
 
 
     return success