git » libjio » commit c1b3140

tests: Add PYTHON3PATH hack to jiostress

author Alberto Bertogli
2018-10-14 20:29:25 UTC
committer Alberto Bertogli
2018-10-14 20:29:25 UTC
parent 371a33e03b4e3c8207a6a6dd03fcc79d2a6451cd

tests: Add PYTHON3PATH hack to jiostress

If we want to use a custom python path when testing, it is inconvenience
because we use both python 2 and 3 in our tests, but both will be
looking at the same environment variable ($PYTHONPATH), and modules are
likely incompatible between the two.

This patch adds a hack to jiostress so we can run:

PYTHONPATH=xxx PYTHON3PATH=yyy make tests

and have things work the way we expect. It's not pretty, but it's
practical and not very intrusive.

tests/stress/jiostress +5 -0

diff --git a/tests/stress/jiostress b/tests/stress/jiostress
index faa5d06..ecb2075 100755
--- a/tests/stress/jiostress
+++ b/tests/stress/jiostress
@@ -9,6 +9,11 @@ failures.
 
 import sys
 import os
+
+# Extend the modules path with PYTHON3PATH, which is useful for automated
+# testing under some conditions.
+sys.path[1:1] = os.getenv("PYTHON3PATH", "").split(os.pathsep)
+
 import time
 import select
 import random