]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
misc/build_helpers/run_trial.py: ensure that pywin32 is not on the sys.path when...
authordavid-sarah <david-sarah@jacaranda.org>
Fri, 22 Jul 2011 02:49:07 +0000 (19:49 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Fri, 22 Jul 2011 02:49:07 +0000 (19:49 -0700)
misc/build_helpers/run_trial.py

index 92058396df6cae77b85d62cdff107fbe54a30516..246572b9494a638a920d50385901c943e7d2dbb3 100644 (file)
@@ -2,6 +2,24 @@
 
 import os, sys, re, glob
 
+if sys.platform == "win32":
+    # Buildbot depends on pywin32, but we don't want it to be available to the code under test.
+    def not_pywin32(entry):
+        dirs = os.path.normcase(entry).replace('/', '\\').split('\\')
+        return "win32" not in dirs and "pythonwin" not in dirs
+
+    print sys.path
+    sys.path = filter(not_pywin32, sys.path)
+    print sys.path
+
+    try:
+        import win32api
+    except ImportError:
+        pass  # expected
+    else:
+        raise AssertionError("We were unable to expunge pywin32 from the sys.path.")
+
+
 def read_version_py(infname):
     try:
         verstrline = open(infname, "rt").read()