diff --git a/test.py b/test.py
index <HASH>..<HASH> 100644
--- a/test.py
+++ b/test.py
@@ -131,6 +131,18 @@ if not skipUnless:
                 return skip
         return wrapper
 
+def requires_progs(*progs):
+    missing = []
+    for prog in progs:
+        try:
+            sh.Command(prog)
+        except sh.CommandNotFound:
+            missing.append(prog)
+
+    friendly_missing = ", ".join(missing)
+    return skipUnless(len(missing) == 0, "Missing required system programs: %s"
+            % friendly_missing)
+
 requires_posix = skipUnless(os.name == "posix", "Requires POSIX")
 requires_utf8 = skipUnless(sh.DEFAULT_ENCODING == "UTF-8", "System encoding must be UTF-8")
 not_osx = skipUnless(not IS_OSX, "Doesn't work on OSX")
@@ -2534,6 +2546,7 @@ print("cool")
     # for some reason, i can't get a good stable baseline measured in this test
     # on osx.  so skip it for now if osx
     @not_osx
+    @requires_progs("lsof")
     def test_no_fd_leak(self):
         import sh
         import os
mechanism for skipping test based on missing system bins