diff options
author | Peter Mikus <pmikus@cisco.com> | 2018-09-01 15:29:37 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-09-04 07:29:54 +0000 |
commit | be430a282810185c939c1fbbf3042036b814f38a (patch) | |
tree | 1d5a18291e74ee892703e7bc81ed96209e8716ae /resources/libraries/python/autogen/Regenerator.py | |
parent | 7db6faf25da39820d321222f7f8fcb191585add9 (diff) |
Fix pylint part 1
- Decrease pylint errors. Part: easy
Change-Id: I452e5b5a11e9b78c03cd173a3848babe21b93c73
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/autogen/Regenerator.py')
-rw-r--r-- | resources/libraries/python/autogen/Regenerator.py | 34 |
1 files changed, 33 insertions, 1 deletions
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) |