From 3e79c23fc7570abbc392619acab52facd902582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E4=BA=91=E7=9A=93?= Date: Fri, 6 Dec 2024 16:12:18 +0800 Subject: [PATCH] fix import error --- src/rpmquery/querylayeriniso.py | 15 +++++---------- src/rpmquery/rpmquery.py | 2 +- test/test_rpmcheck.py | 9 +++++++++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/rpmquery/querylayeriniso.py b/src/rpmquery/querylayeriniso.py index c887fd7..cfd34f9 100644 --- a/src/rpmquery/querylayeriniso.py +++ b/src/rpmquery/querylayeriniso.py @@ -12,17 +12,12 @@ # See the Mulan PSL v2 for more details. # ********************************************************************************** """ -import os -import sys -current_path = os.path.dirname(__file__) -parent_path = os.path.dirname(current_path) -sys.path.append(parent_path) -from rpmquery import RpmQuery -from utils.util import ISOUtils -from utils.depparse import ISODepParse -from utils.config import BaseConfig -from main.alglayer import AlgLayer +from .rpmquery import RpmQuery +from src.utils.util import ISOUtils +from src.utils.depparse import ISODepParse +from src.utils.config import BaseConfig +from src.main.alglayer import AlgLayer class QueryLayerInIso(RpmQuery): diff --git a/src/rpmquery/rpmquery.py b/src/rpmquery/rpmquery.py index 22e4bc4..fb76e64 100644 --- a/src/rpmquery/rpmquery.py +++ b/src/rpmquery/rpmquery.py @@ -15,7 +15,7 @@ import rpm -from rpmhdrinfo import RpmHdrInfo +from .rpmhdrinfo import RpmHdrInfo class RpmQuery(object): """ diff --git a/test/test_rpmcheck.py b/test/test_rpmcheck.py index 93707ce..7435802 100644 --- a/test/test_rpmcheck.py +++ b/test/test_rpmcheck.py @@ -37,6 +37,15 @@ class TestRpmCheck(unittest.TestCase): """ result = self.rpm_check.check_exist() self.assertIn(result, [True, False], "check_exist test failed!") + + def test_check_formate(self): + """ + Test class method check_formate() + Returns: + bool + """ + result = self.rpm_check.check_formate() + self.assertIn(result, [True, False], "check_formate test failed!") if __name__ == "__main__": -- Gitee