From dce7b95bcd56ddedb061bc84c53d986c1dbed879 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 19 Oct 2020 07:02:45 +0200
Subject: [PATCH] slapos/testing: unset PYTHONPATH in CrontabMixin

When we execute crontab commands, these commands might be python scripts, so
we don't want the PYTHONPATH set by `python setup.py test` to apply to these
scripts.
---
 slapos/testing/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/slapos/testing/utils.py b/slapos/testing/utils.py
index d0ac36993..80c473f89 100644
--- a/slapos/testing/utils.py
+++ b/slapos/testing/utils.py
@@ -217,7 +217,8 @@ class CrontabMixin(object):
     """
     crontab_command =  self._getCrontabCommand(crontab_name)
     subprocess.check_call(
-        "faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()),
+        # XXX we unset PYTHONPATH set by `setup.py test`
+        "env PYTHONPATH= faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()),
         shell=True,
     )
 
-- 
2.30.9