aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/autogen/Regenerator.py
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python/autogen/Regenerator.py')
-rw-r--r--resources/libraries/python/autogen/Regenerator.py34
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)