Skip to content

Commit

Permalink
Rename from coda to cpptest
Browse files Browse the repository at this point in the history
  • Loading branch information
phiwuu committed Oct 2, 2024
1 parent 8175546 commit 483f3e4
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion lobster-coda → lobster-cpptest
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import sys

from lobster.tools.coda.coda import main
from lobster.tools.cpptest.cpptest import main

if __name__ == "__main__":
sys.exit(main())
File renamed without changes.
18 changes: 9 additions & 9 deletions lobster/tools/coda/coda.py → lobster/tools/cpptest/cpptest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# lobster_coda - Extract C/C++ tracing tags from commands for LOBSTER
# lobster_cpptest - Extract C++ tracing tags from comments in tests for LOBSTER
# Copyright (C) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -27,8 +27,8 @@
from lobster.items import Tracing_Tag, Activity
from lobster.location import File_Reference
from lobster.io import lobster_write
from lobster.tools.coda.parser.constants import Constants
from lobster.tools.coda.parser.requirements_parser import ParserForRequirements
from lobster.tools.cpptest.parser.constants import Constants
from lobster.tools.cpptest.parser.requirements_parser import ParserForRequirements

OUTPUT = "output"
CODEBEAMER_URL = "codebeamer_url"
Expand Down Expand Up @@ -66,7 +66,7 @@ def parse_config_file(file_name: str) -> dict:
"""
Parse the configuration dictionary from given config file.
The configuration dictionary for coda must contain the OUTPUT and
The configuration dictionary for cpptest must contain the OUTPUT and
CODEBEAMER_URL keys.
Each output configuration dictionary contains a file name as key and
a value dictionary containing the keys MARKERS and KIND.
Expand All @@ -76,12 +76,12 @@ def parse_config_file(file_name: str) -> dict:
Parameters
----------
file_name : str
The file name of the coda config file.
The file name of the cpptest config file.
Returns
-------
dict
The dictionary containing the configuration for coda.
The dictionary containing the configuration for cpptest.
Raises
------
Expand Down Expand Up @@ -330,7 +330,7 @@ def write_lobster_items_output_dict(lobster_items_output_dict: dict):
print(f'Written {item_count} lobster items to stdout.')


def lobster_coda(file_dir_list: list, config_dict: dict):
def lobster_cpptest(file_dir_list: list, config_dict: dict):
"""
The main function to parse requirements from comments
for the given list of files and/or directories and write the
Expand Down Expand Up @@ -369,7 +369,7 @@ def lobster_coda(file_dir_list: list, config_dict: dict):
def main():
"""
Main function to parse arguments, read configuration
and launch lobster_coda.
and launch lobster_cpptest.
"""
ap = argparse.ArgumentParser()
ap.add_argument("files",
Expand All @@ -387,7 +387,7 @@ def main():
try:
config_dict = parse_config_file(options.config_file)

lobster_coda(
lobster_cpptest(
file_dir_list=options.files,
config_dict=config_dict
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, codebeamer_url = ''):

NON_EXISTING_INFO = "---"

LOBSTER_GENERATOR = "lobster_coda"
LOBSTER_GENERATOR = "lobster-cpptest"

VALID_TESTMETHODS = [
"TM_EQUIVALENCE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import List

from lobster.tools.coda.parser.test_case import TestCase
from lobster.tools.cpptest.parser.test_case import TestCase


class ParserForRequirements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from typing import List

from lobster.tools.coda.parser.constants import Constants
from lobster.tools.cpptest.parser.constants import Constants


class TestCase:
Expand Down
1 change: 0 additions & 1 deletion packages/lobster-tool-coda/entrypoints

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package:
rm -rf lobster
mkdir -p lobster/tools
cp -Rv $(LOBSTER_ROOT)/lobster/tools/coda lobster/tools
cp -Rv $(LOBSTER_ROOT)/lobster/tools/cpptest lobster/tools
@python3 setup.py sdist bdist_wheel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from the provided comments in cpp files

## Tools

* `lobster-coda`: Extract requirements with dynamic refrences
* `lobster-cpptest`: Extract requirements with dynamic refrences
from comments.

## Usage
Expand Down
1 change: 1 addition & 0 deletions packages/lobster-tool-cpptest/entrypoints
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lobster-cpptest = lobster.tools.cpptest.cpptest:main
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

setuptools.setup(
name="bmw-lobster-tool-coda",
name="bmw-lobster-tool-cpptest",
version=version.LOBSTER_VERSION,
author="Bayerische Motoren Werke Aktiengesellschaft (BMW AG)",
author_email="[email protected]",
Expand All @@ -55,7 +55,7 @@
url=project_urls["Source Code"],
project_urls=project_urls,
license="GNU Affero General Public License v3",
packages=["lobster.tools.coda"],
packages=["lobster.tools.cpptest"],
install_requires=package_requirements,
python_requires=">=3.7, <4",
classifiers=[
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import unittest
from pathlib import Path

from lobster.tools.coda.coda import *
from lobster.tools.coda.parser.constants import Constants
from lobster.tools.coda.parser.requirements_parser import ParserForRequirements
from lobster.tools.cpptest.cpptest import *
from lobster.tools.cpptest.parser.constants import Constants
from lobster.tools.cpptest.parser.requirements_parser import ParserForRequirements


class LobsterCodaTests(unittest.TestCase):
class LobsterCpptestTests(unittest.TestCase):
# unit tests for lobster-cpptest

def setUp(self):
self.lobster_generator = Constants.LOBSTER_GENERATOR
Expand All @@ -17,8 +18,8 @@ def setUp(self):
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_coda-1.config'))
self.test_config_2 = str(Path('./data', 'test_coda-2.config'))
self.test_config_1 = str(Path('./data', 'test_1.config'))
self.test_config_2 = str(Path('./data', 'test_2.config'))

self.req_test_type = [RequirementTypes.REQS.value]
self.req_by_test_type = [RequirementTypes.REQ_BY.value]
Expand Down Expand Up @@ -207,7 +208,7 @@ def test_get_test_file_list_not_existing_file_dir(self):
exception_string = str(test_get_test_file_list.exception)
self.assertEqual(f'"{self.test_fake_dir}" is not a file or directory.', exception_string)

def test_lobster_coda_single_file(self):
def test_single_file(self):
file_dir_list = [self.test_case_file]

if os.path.exists(self.output_file_name):
Expand All @@ -230,15 +231,15 @@ def test_lobster_coda_single_file(self):
CODEBEAMER_URL: "https://codebeamer.com"
}

lobster_coda(
lobster_cpptest(
file_dir_list=file_dir_list,
config_dict=config_dict
)

file_exists = os.path.exists(self.output_file_name)
self.assertTrue(file_exists)

def test_lobster_coda_single_directory(self):
def test_single_directory(self):
file_dir_list = [self.test_data_dir]

if os.path.exists(self.output_data_file_name):
Expand All @@ -261,15 +262,15 @@ def test_lobster_coda_single_directory(self):
CODEBEAMER_URL: "https://codebeamer.com"
}

lobster_coda(
lobster_cpptest(
file_dir_list=file_dir_list,
config_dict=config_dict
)

file_exists = os.path.exists(self.output_data_file_name)
self.assertTrue(file_exists)

def test_lobster_coda_not_existing_file_dir(self):
def test_not_existing_file_dir(self):
file_dir_list = [self.test_fake_dir]

if os.path.exists(self.output_fake_file_name):
Expand All @@ -288,23 +289,23 @@ def test_lobster_coda_not_existing_file_dir(self):
CODEBEAMER_URL: "https://codebeamer.com"
}

with self.assertRaises(Exception) as test_lobster_coda:
lobster_coda(
with self.assertRaises(Exception) as wrapper:
lobster_cpptest(
file_dir_list=file_dir_list,
config_dict=config_dict
)

exception_string = str(test_lobster_coda.exception)
exception_string = str(wrapper.exception)
self.assertEqual(f'"{self.test_fake_dir}" is not a file or directory.', exception_string)

file_exists = os.path.exists(self.output_fake_file_name)
self.assertFalse(file_exists)

def test_lobster_coda_separate_output_config(self):
def test_separate_output_config(self):
file_dir_list = [self.test_case_file]
config_dict: dict = parse_config_file(self.test_config_1)

lobster_coda(
lobster_cpptest(
file_dir_list=file_dir_list,
config_dict=config_dict
)
Expand Down

0 comments on commit 483f3e4

Please sign in to comment.