X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fautogen%2FRegenerator.py;h=7a576764a259a56046fe2f67a6ed651c1a9dfcec;hb=be430a282810185c939c1fbbf3042036b814f38a;hp=e7e037032541e711ceb78693bcc2de8404f10e30;hpb=5d6479beed22bb3d14a39e9c130946959c13f03e;p=csit.git diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py index e7e0370325..7a576764a2 100644 --- a/resources/libraries/python/autogen/Regenerator.py +++ b/resources/libraries/python/autogen/Regenerator.py @@ -16,7 +16,6 @@ from glob import glob from os import getcwd -from .Testcase import Testcase from .DefaultTestcase import DefaultTestcase @@ -63,6 +62,13 @@ class Regenerator(object): } def get_iface_and_suite_id(filename): + """Get interface and suite ID. + + :param filename: Suite file. + :type filename: str + :returns: Interface ID, Suite ID. + :rtype: tuple + """ dash_split = filename.split("-", 1) if len(dash_split[0]) <= 4: # It was something like "2n1l", we need one more split. @@ -70,12 +76,38 @@ class Regenerator(object): return dash_split[0], dash_split[1].split(".", 1)[0] def add_testcase(testcase, iface, file_out, num, **kwargs): + """Add testcase to file. + + :param testcase: Testcase class. + :param iface: Interface. + :param file_out: File to write testcases to. + :param num: Testcase number. + :param kwargs: Key-value pairs used to construct testcase. + :type testcase: Testcase + :type iface: str + :type file_out: file + :type num: int + :type kwargs: dict + :returns: Next testcase number. + :rtype: int + """ # TODO: Is there a better way to disable some combinations? if kwargs["framesize"] != 9000 or "vic1227" not in iface: file_out.write(testcase.generate(num=num, **kwargs)) return num + 1 def add_testcases(testcase, iface, file_out, tc_kwargs_list): + """Add testcases to file. + + :param testcase: Testcase class. + :param iface: Interface. + :param file_out: File to write testcases to. + :param tc_kwargs_list: Key-value pairs used to construct testcase. + :type testcase: Testcase + :type iface: str + :type file_out: file + :type tc_kwargs_list: dict + """ num = 1 for tc_kwargs in tc_kwargs_list: num = add_testcase(testcase, iface, file_out, num, **tc_kwargs)