From a57e732abb9f4d97e241c0b22f6ebb88d8666eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Iranzo=20G=C3=B3mez?= Date: Thu, 22 Aug 2024 16:32:55 +0200 Subject: [PATCH] Fix import path --- tests/cf-uts/test_cf_is_active.py | 13 +++++++------ tests/cf-uts/test_cf_is_lineinfile.py | 8 +++++--- tests/cf-uts/test_cf_is_process.py | 13 +++++++------ tests/cf-uts/test_cf_is_required_file.py | 8 +++++--- tests/cf-uts/test_cf_is_required_rpm.py | 13 +++++++------ tests/cf-uts/test_cf_is_rpm.py | 7 +++++-- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/tests/cf-uts/test_cf_is_active.py b/tests/cf-uts/test_cf_is_active.py index a98b3b6f..5cae8d6e 100755 --- a/tests/cf-uts/test_cf_is_active.py +++ b/tests/cf-uts/test_cf_is_active.py @@ -13,6 +13,8 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import shutil import subprocess @@ -20,13 +22,12 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_active" diff --git a/tests/cf-uts/test_cf_is_lineinfile.py b/tests/cf-uts/test_cf_is_lineinfile.py index f0a6fcf2..f4b65cdc 100755 --- a/tests/cf-uts/test_cf_is_lineinfile.py +++ b/tests/cf-uts/test_cf_is_lineinfile.py @@ -23,10 +23,12 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu - -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_lineinfile" diff --git a/tests/cf-uts/test_cf_is_process.py b/tests/cf-uts/test_cf_is_process.py index ea3ab276..08c0dfab 100755 --- a/tests/cf-uts/test_cf_is_process.py +++ b/tests/cf-uts/test_cf_is_process.py @@ -13,6 +13,8 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import shutil import subprocess @@ -20,13 +22,12 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_process" diff --git a/tests/cf-uts/test_cf_is_required_file.py b/tests/cf-uts/test_cf_is_required_file.py index 0e2fc2f7..f86cced1 100755 --- a/tests/cf-uts/test_cf_is_required_file.py +++ b/tests/cf-uts/test_cf_is_required_file.py @@ -23,10 +23,12 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu - -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_required_file" diff --git a/tests/cf-uts/test_cf_is_required_rpm.py b/tests/cf-uts/test_cf_is_required_rpm.py index dc672072..7fdc9e3f 100755 --- a/tests/cf-uts/test_cf_is_required_rpm.py +++ b/tests/cf-uts/test_cf_is_required_rpm.py @@ -13,6 +13,8 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import shutil import subprocess @@ -20,13 +22,12 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_required_rpm" diff --git a/tests/cf-uts/test_cf_is_rpm.py b/tests/cf-uts/test_cf_is_rpm.py index 2b4cc453..d89187fa 100755 --- a/tests/cf-uts/test_cf_is_rpm.py +++ b/tests/cf-uts/test_cf_is_rpm.py @@ -23,10 +23,13 @@ import tempfile from unittest import TestCase -import risuclient.shell as risu +sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../")) -sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../")) +try: + import risuclient.shell as risu +except: + import shell as risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py NAME = "test_cf_is_rpm"