From 772c47a121a0c2ef2e5c3c07014ac329b0ad9de6 Mon Sep 17 00:00:00 2001 From: Steven Li Date: Sat, 18 Apr 2020 20:35:01 -0700 Subject: [PATCH] Now able to run Python test against local server, without sudo/root privileges --- tests/pytest/simpletest_no_sudo.sh | 13 +++++++++++++ tests/pytest/test.py | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 tests/pytest/simpletest_no_sudo.sh diff --git a/tests/pytest/simpletest_no_sudo.sh b/tests/pytest/simpletest_no_sudo.sh new file mode 100755 index 0000000000..61faf3df52 --- /dev/null +++ b/tests/pytest/simpletest_no_sudo.sh @@ -0,0 +1,13 @@ +# This is the script for us to run our Python test cases with 2 important constraints: +# +# 1. No root/sudo special rights is needed. +# 2. No files are needed outside the development tree, everything is done in the local source code directory + +# First we need to set up a path for Python to find our own TAOS modules, so that "import" can work. +export PYTHONPATH=$(pwd)/../../src/connector/python/linux/python3 + +# Then let us set up the library path so that our compiled SO file can be loaded by Python +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/../../build/build/lib + +# Now we are all let, and let's run our cases! +python3 ./test.py -m 127.0.0.1 -f insert/basic.py diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 0a524b44fa..ea727d5f6e 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -77,10 +77,10 @@ if __name__ == "__main__": conn.close() else: tdLog.notice("Procedures for tdengine deployed in %s" % (masterIp)) - conn = taos.connect(host=masterIp, config=tdDnodes.getSimCfgPath()) + cfgPath = "../../build/test/cfg" # was: tdDnodes.getSimCfgPath() + conn = taos.connect(host=masterIp, config=cfgPath) if fileName == "all": tdCases.runAllWindows(conn) else: tdCases.runOneWindows(conn, fileName) conn.close() - -- GitLab