]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Add "which" function to k5test
authorGreg Hudson <ghudson@mit.edu>
Sat, 28 Sep 2013 18:56:22 +0000 (14:56 -0400)
committerGreg Hudson <ghudson@mit.edu>
Sat, 28 Sep 2013 18:57:18 +0000 (14:57 -0400)
Add a utility function in k5test.py to look for a command in the
executable path, and remove it from t_kdb.py.

src/tests/t_kdb.py
src/util/k5test.py

index 70fe58a8403dc7930d577e93833113f77e57c12c..64ce682cc9fff432219cda80b61175f3781c02f4 100644 (file)
@@ -2,15 +2,6 @@
 from k5test import *
 import time
 
-# Return the location of progname in tht executable path, or None if
-# it is not found.
-def which(progname):
-    for dir in os.environ["PATH"].split(os.pathsep):
-        path = os.path.join(dir, progname)
-        if os.access(path, os.X_OK):
-            return path
-    return None
-
 # Run kdbtest against the BDB module.
 realm = K5Realm(create_kdb=False)
 realm.run(['./kdbtest'])
index 017aa0c7fb436ff93c99351904dfe88de7841087..aead8321770ff909650596fee866eff83836b95f 100644 (file)
@@ -133,6 +133,9 @@ Scripts may use the following functions and variables:
   added newline) in testlog, and write it to stdout if running
   verbosely.
 
+* which(progname): Return the location of progname in the executable
+  path, or None if it is not found.
+
 * password(name): Return a weakly random password based on name.  The
   password will be consistent across calls with the same name.
 
@@ -371,6 +374,16 @@ def output(msg, force_verbose=False):
         sys.stdout.write(msg)
 
 
+# Return the location of progname in the executable path, or None if
+# it is not found.
+def which(progname):
+    for dir in os.environ["PATH"].split(os.pathsep):
+        path = os.path.join(dir, progname)
+        if os.access(path, os.X_OK):
+            return path
+    return None
+
+
 def password(name):
     """Choose a weakly random password from name, consistent across calls."""
     return name + str(os.getpid())