From a2f4dd4227c60718e4e3d6d0a84bca995ee0d56c Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Tue, 17 Sep 2024 12:10:02 +0200 Subject: [PATCH] some fixes to run tests from pycharm with a suid-python binary --- tests/basetest.py | 6 +++++- tests/tests | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 120000 tests/tests diff --git a/tests/basetest.py b/tests/basetest.py index d507d8b..70de515 100644 --- a/tests/basetest.py +++ b/tests/basetest.py @@ -1,4 +1,4 @@ - +import os # To run tests as non-root, use this hack: # chmod 4755 /usr/sbin/zpool /usr/sbin/zfs @@ -51,6 +51,10 @@ else: OutputIO=io.StringIO +# for when we're using a suid-root python binary during development +os.setuid(0) +os.setgid(0) + # for python2 compatibility (python 3 has this already) @contextlib.contextmanager diff --git a/tests/tests b/tests/tests new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/tests @@ -0,0 +1 @@ +. \ No newline at end of file