aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/OptionString.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-07-17 12:40:49 +0200
committerVratko Polak <vrpolak@cisco.com>2019-07-17 12:40:49 +0200
commitf88a3d9178dfbd73d0479f9aa2f5224e0c89ca1f (patch)
tree9963cb06a7f089d815f9ebf5e5ba8d8f1f26a209 /resources/libraries/python/OptionString.py
parent248d1a52e06622dc9eb1dfdd6ca9f6670b4c0bc3 (diff)
Use PapiSocketProvider for most PAPI calls
Ticket: CSIT-1541 Ticket: VPP-1722 Ticket: CSIT-1546 + Increase timeout to hide x520 slownes of show hardware detail. - Install sshpass and update ssh client in virl bootstrap. + Added TODOs to remove when CSIT-1546 is fixed. + Enable default socksvr on any startup conf. + Improve OptionString init and repr. - The non-socket executor still kept for stats. + Remove everything unrelated to stats from non-socket executor. - Remove some debug-loooking calls to avoid failures. TODO: Introduce proper parsing to the affected keywords. + Reduce logging from PAPI code to level INFO. - Needs https://gerrit.fd.io/r/20660 to fully work. + Change default values for LocalExecution.run() + Return code check enabled by default. Code is more readable when rc!=0 is allowed explicitly, and the test code will now detect unexpected failures. + Logging disabled by default. Output XML is large already. Important logging can be enabled explicitly. + Restore alphabetical order in common.sh functions. Change-Id: I05882cb6b620ad14638f7404b5ad38c7a5de9e6c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/OptionString.py')
-rw-r--r--resources/libraries/python/OptionString.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/resources/libraries/python/OptionString.py b/resources/libraries/python/OptionString.py
index 7c8b2d066a..7163d057ec 100644
--- a/resources/libraries/python/OptionString.py
+++ b/resources/libraries/python/OptionString.py
@@ -36,19 +36,21 @@ class OptionString(object):
the best fitting one, without much logic near the call site.
"""
- def __init__(self, prefix="", *args):
+ def __init__(self, parts=tuple(), prefix=""):
"""Create instance with listed strings as parts to use.
Prefix will be converted to string and stripped.
The typical (nonempty) prefix values are "-" and "--".
+ TODO: Support users calling with parts being a string?
+
+ :param parts: List of of stringifiable objects to become parts.
:param prefix: Subtring to prepend to every parameter (not value).
- :param args: List of positional arguments to become parts.
+ :type parts: Iterable of object
:type prefix: object
- :type args: list of object
"""
+ self.parts = [str(part) for part in parts]
self.prefix = str(prefix).strip() # Not worth to call change_prefix.
- self.parts = list(args)
def __repr__(self):
"""Return string executable as Python constructor call.
@@ -56,12 +58,11 @@ class OptionString(object):
:returns: Executable constructor call as string.
:rtype: str
"""
- return "".join([
- "OptionString(prefix=", repr(self.prefix), ",",
- repr(self.parts)[1:-1], ")"])
+ return "OptionString(parts={parts!r},prefix={prefix!r})".format(
+ parts=self.parts, prefix=self.prefix)
# TODO: Would we ever need a copy() method?
- # Currently, supersting "master" is mutable but unique,
+ # Currently, superstring "master" is mutable but unique,
# substring "slave" can be used to extend, but does not need to be mutated.
def change_prefix(self, prefix):