diff --git a/lobster/tools/cpptest/cpptest.py b/lobster/tools/cpptest/cpptest.py index 35e0a162..caa3a300 100644 --- a/lobster/tools/cpptest/cpptest.py +++ b/lobster/tools/cpptest/cpptest.py @@ -28,7 +28,8 @@ from lobster.location import File_Reference from lobster.io import lobster_write from lobster.tools.cpptest.parser.constants import Constants -from lobster.tools.cpptest.parser.requirements_parser import ParserForRequirements +from lobster.tools.cpptest.parser.requirements_parser import \ + ParserForRequirements OUTPUT = "output" CODEBEAMER_URL = "codebeamer_url" diff --git a/test-unit/lobster-cpptest/test_cpptest.py b/test-unit/lobster-cpptest/test_cpptest.py index 85fde717..9e851dac 100644 --- a/test-unit/lobster-cpptest/test_cpptest.py +++ b/test-unit/lobster-cpptest/test_cpptest.py @@ -1,5 +1,6 @@ import os import unittest +from os.path import dirname from pathlib import Path from lobster.tools.cpptest.cpptest import * @@ -15,11 +16,11 @@ def setUp(self): self.other_test_lobster_file = 'other_tests.lobster' self.unit_test_lobster_file = 'unit_tests.lobster' self.component_test_lobster_file = 'component_tests.lobster' - self.test_fake_dir = str(Path('./not_existing')) - self.test_data_dir = str(Path('./data')) - self.test_case_file = str(Path('./data', 'test_case.cpp')) - self.test_config_1 = str(Path('./data', 'test_1.config')) - self.test_config_2 = str(Path('./data', 'test_2.config')) + self.test_fake_dir = str(Path(dirname(__file__), "not_existing")) + self.test_data_dir = str(Path(dirname(__file__), "data")) + self.test_case_file = str(Path(dirname(__file__), "data", "test_case.cpp")) + self.test_config_1 = str(Path(dirname(__file__), "data", "test_1.config")) + self.test_config_2 = str(Path(dirname(__file__), "data", "test_2.config")) self.req_test_type = [RequirementTypes.REQS.value] self.req_by_test_type = [RequirementTypes.REQ_BY.value] @@ -174,7 +175,7 @@ def test_get_test_file_list(self): self.assertIsNotNone(test_file_list) self.assertIsInstance(test_file_list, list) self.assertEqual(1, len(test_file_list)) - self.assertTrue('data\\test_case.cpp' in test_file_list) + self.assertTrue(self.test_case_file in test_file_list) def test_get_test_file_list_no_file_with_matching_extension(self): file_dir_list = [self.test_data_dir] @@ -383,7 +384,6 @@ def test_test_case_parsing(self): The whole TestCase class is tested as one since the test_file contains all possible variant of an allowed test case implementation """ - # fmt: off codebeamer_url = "https://codebeamer.com" expect = [ # Verify that test macros, test suite, test name and documentation comments are correctly parsed @@ -463,9 +463,6 @@ def test_test_case_parsing(self): "testmethods": ["TM_PAIRWISE", "TM_BOUNDARY"]}, {"suite": "TestMethodsTagTest2", "test_name": "TestMethodAsCommentsCommaSeparated", "testmethods": ["TM_REQUIREMENT", "TM_EQUIVALENCE"]}, - # {"suite": "TestMethodsTagTest2", "test_name": "TestMethodAsCommentsMultipleLines", - # "testmethods": ["TM_REQUIREMENT", "TM_EQUIVALENCE", "TM_BOUNDARY", "TM_CONDITION"]}, - # TODO: Not supported yet, to be discussed in DCS-3430 {"suite": "TestMethodsTagTest3", "test_name": "InvalidTestMethod", "testmethods": []}, {"suite": "TestMethodsTagTest4", "test_name": "MissingTestMethod", "testmethods": []}, # Verify that the version tag is correctly parsed @@ -484,7 +481,6 @@ def test_test_case_parsing(self): "req": ["CB-#0815", "CB-#0816"], "req_by": ["FOO0::BAR0"], "testmethods": ["TM_BOUNDARY", "TM_REQUIREMENT"]} ] - # fmt: on test_cases = ParserForRequirements.collect_test_cases(self.test_case_file, codebeamer_url) self.assertEqual(len(test_cases), 45)