Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
- Remove references to BMW
- Use absolute pathes in unit tests, so that tests run in the CI regardless of
  the current working directory.
- Pylint fixes
  • Loading branch information
phiwuu committed Oct 2, 2024
1 parent 1b5a6b4 commit b116da0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion lobster/tools/cpptest/cpptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 7 additions & 11 deletions test-unit/lobster-cpptest/test_cpptest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import unittest
from os.path import dirname
from pathlib import Path

from lobster.tools.cpptest.cpptest import *
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit b116da0

Please sign in to comment.