From 0c838aaf4b56ba4fbe3ef645c8e24a9d1a1bac7e Mon Sep 17 00:00:00 2001 From: panzhe0328 Date: Fri, 6 Dec 2024 14:48:06 +0800 Subject: [PATCH] Add unit test for localcheck --- test/__init__.py | 1 + test/test_localcheck.py | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/test_localcheck.py diff --git a/test/__init__.py b/test/__init__.py index 92eb20c..d768790 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -26,6 +26,7 @@ from test_alglayer import TestAlglayer from test_dataparse import TestDataParse from test_depparse import TestDepParse from test_isocheck import TestIsoCheck +from test_localcheck import TestLocalCheck from test_repocheck import TestRepoCheck from test_util import TestUtil diff --git a/test/test_localcheck.py b/test/test_localcheck.py new file mode 100644 index 0000000..e429869 --- /dev/null +++ b/test/test_localcheck.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +""" +# ********************************************************************************** +# Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. +# [kyclassifier] licensed under the Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# http://license.coscl.org.cn/MulanPSL2 +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR +# PURPOSE. +# See the Mulan PSL v2 for more details. +# ********************************************************************************** +""" + +import unittest + +from src.utils.localcheck import LocalCheck + + +class TestLocalCheck(unittest.TestCase): + + def setUp(self): + self.local_check = LocalCheck() + + def tearDown(self): + """Clear test data + """ + pass + + def test_check_pkgsmissreq(self): + """Test class method check_pkgsmissreq() + + Returns: + bool + """ + result = self.local_check.check_pkgsmissreq() + self.assertIsInstance(result, dict, "check_pkgsmissreq test failed!") + + def test_check(self): + """Test class method check() + + Returns: + bool + """ + result = self.local_check.check() + self.assertIn(result, [True, False], "check test failed!") + + +if __name__ == "__main__": + unittest.main(verbosity=2) \ No newline at end of file -- Gitee