aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/autogen
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-09-01 15:29:37 +0000
committerPeter Mikus <pmikus@cisco.com>2018-09-04 07:29:54 +0000
commitbe430a282810185c939c1fbbf3042036b814f38a (patch)
tree1d5a18291e74ee892703e7bc81ed96209e8716ae /resources/libraries/python/autogen
parent7db6faf25da39820d321222f7f8fcb191585add9 (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')
-rw-r--r--resources/libraries/python/autogen/Regenerator.py34
-rw-r--r--resources/libraries/python/autogen/Testcase.py6
2 files changed, 36 insertions, 4 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)
diff --git a/resources/libraries/python/autogen/Testcase.py b/resources/libraries/python/autogen/Testcase.py
index 4f92e6c2e1..dd58547f33 100644
--- a/resources/libraries/python/autogen/Testcase.py
+++ b/resources/libraries/python/autogen/Testcase.py
@@ -49,10 +49,10 @@ class Testcase(object):
:rtype: str
"""
try:
- fs = int(framesize)
+ fsize = int(framesize)
subst_dict = {
- "frame_num": "${%d}" % fs,
- "frame_str": "%dB" % fs
+ "frame_num": "${%d}" % fsize,
+ "frame_str": "%dB" % fsize
}
except ValueError: # Assuming an IMIX string.
subst_dict = {