Commit 1f59ba1b authored by Łukasz Nowak's avatar Łukasz Nowak

monitor/test: Remove PYTHONPATH while calling python

The called python program is python3 program, and provided
PYTHONPATH is from python2, resulting in bad behaviour.
parent 6acdc8ca
Pipeline #7236 failed with stage
in 0 seconds
...@@ -225,7 +225,13 @@ class EdgeSlaveMixin(MonitorTestMixin): ...@@ -225,7 +225,13 @@ class EdgeSlaveMixin(MonitorTestMixin):
def assertSurykatkaStatusJSON(self): def assertSurykatkaStatusJSON(self):
if os.path.exists(self.surykatka_json): if os.path.exists(self.surykatka_json):
os.unlink(self.surykatka_json) os.unlink(self.surykatka_json)
original_environ = os.environ.copy()
os.environ.pop('PYTHONPATH', None)
try:
self.assertEqual(0, os.system(self.surykatka_status_json)) self.assertEqual(0, os.system(self.surykatka_status_json))
finally:
os.environ = original_environ
self.assertTrue(os.path.exists(self.surykatka_json)) self.assertTrue(os.path.exists(self.surykatka_json))
with open(self.surykatka_json) as fh: with open(self.surykatka_json) as fh:
status_json = json.load(fh) status_json = json.load(fh)
......
  • mentioned in commit 6e65bb9d

    Toggle commit list
  • BTW, this is easier with subprocess

    subprocess.check_call((self.surykatka_status_json, ), env={k: v for (k, v) in os.environ.items() if k != 'PYTHONPATH'})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment