From: david-sarah Date: Fri, 22 Jul 2011 02:49:07 +0000 (-0700) Subject: misc/build_helpers/run_trial.py: ensure that pywin32 is not on the sys.path when... X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/module-simplejson.tests.html?a=commitdiff_plain;h=6e0607f4e05b159c7412d1dcc5613c718c3c7157;p=tahoe-lafs%2Ftahoe-lafs.git misc/build_helpers/run_trial.py: ensure that pywin32 is not on the sys.path when running the test suite. Includes some temporary debugging printouts that will be removed. refs #1334 --- diff --git a/misc/build_helpers/run_trial.py b/misc/build_helpers/run_trial.py index 92058396..246572b9 100644 --- a/misc/build_helpers/run_trial.py +++ b/misc/build_helpers/run_trial.py @@ -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()