Commit a7e95248 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

Merge branch 'fix/parent-release-handling' into 'master'

fix: parent release handling in generated documentation

See merge request !138
parents d9ee0559 1f6ccaf0
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
@@ -121,6 +121,38 @@ class GenerateRobotData:
        # Generate the initial_condition of the test suite
        # Generate the initial_condition of the test suite
        self.test_suite['initial_condition'] = self.generate_initial_condition()
        self.test_suite['initial_condition'] = self.generate_initial_condition()


        # Generate the parent release and correct the reference in case that the tags include information since_v1.x.y
        self.get_version()

    def get_version(self):
        data = [x['tags'] for x in self.test_suite['test_cases']]
        aux = [item for sublist in data for item in sublist if item.startswith('since')]

        if len(aux) == 0:
            has_since = False
        else:
            has_since = True

        are_all_same = all(item == aux[0] for item in aux)

        if are_all_same and has_since:
            aux = aux[0]
            aux = aux.split('since_')[1]
        else:
            if has_since:
                print('Error not all the tags have the same version. Select default v1.3.1')

            aux = 'v1.3.1'

        if 'clauses' in self.test_suite['reference']:
            self.test_suite['reference'] = \
                f"ETSI GS CIM 009 V{aux.split('v')[1]} [], clauses {self.test_suite['reference'].split('clauses ')[1]}"
        else:
            self.test_suite['reference'] = \
                f"ETSI GS CIM 009 V{aux.split('v')[1]} [], clause {self.test_suite['reference'].split('clause ')[1]}"

        self.test_suite['parent_release'] = aux

    def generate_initial_condition(self) -> str:
    def generate_initial_condition(self) -> str:
        aux = [x['setup'] for x in self.test_cases]
        aux = [x['setup'] for x in self.test_cases]
        if all(element == aux[0] for element in aux[1:]):
        if all(element == aux[0] for element in aux[1:]):
+2 −2
Original line number Original line Diff line number Diff line
@@ -13,7 +13,7 @@ if __name__ == "__main__":
    number_of_all_testcases = 0
    number_of_all_testcases = 0
    number_of_successes = 0
    number_of_successes = 0
    ROBOT_FILE_EXTENSION = ".robot"
    ROBOT_FILE_EXTENSION = ".robot"
    BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/tests-up-to-1_5/TP/NGSI-LD/"
    BASE_URL_OF_FORGE = "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/master/TP/NGSI-LD/"


    fullpath = basedir + "/TP/NGSI-LD"
    fullpath = basedir + "/TP/NGSI-LD"
    for root, dirs, files in walk(fullpath):
    for root, dirs, files in walk(fullpath):
@@ -35,7 +35,7 @@ if __name__ == "__main__":
                else:
                else:
                    statistics[name_of_test_case]["failed"] = False
                    statistics[name_of_test_case]["failed"] = False
                    number_of_successes += 1
                    number_of_successes += 1
                    # we add it here because Fernando's code does not, in case of successfull parsing
                    # we add it here because Fernando's code does not, in case of successful parsing
                    json_of_test_case["error_while_parsing"] = False
                    json_of_test_case["error_while_parsing"] = False
                    # establish the right configuration
                    # establish the right configuration
                    if json_of_test_case["robotpath"].startswith("ContextSource"):
                    if json_of_test_case["robotpath"].startswith("ContextSource"):