From 5a4fc577cd371f4d804ed2dcf746b8c0be3b0693 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 26 Aug 2016 19:42:00 +0100 Subject: [PATCH] disable_site_packages() helper for ssh_test. --- econtext/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/econtext/utils.py b/econtext/utils.py index 7c1bd8a6..0862ed49 100644 --- a/econtext/utils.py +++ b/econtext/utils.py @@ -13,6 +13,15 @@ import econtext.master LOG = logging.getLogger('econtext') +def disable_site_packages(): + """Remove all entries mentioning site-packages or Extras from the system + path. Used primarily for testing on OS X within a virtualenv, where OS X + bundles some ancient version of the 'six' module.""" + for entry in sys.path[:]: + if 'site-packages' in entry or 'Extras' in entry: + sys.path.remove(entry) + + def log_to_file(path=None, io=True, level=logging.DEBUG): """Install a new :py:class:`logging.Handler` writing applications logs to the filesystem. Useful when debugging slave IO problems."""