[V1] ixia_network/ixnet: fix bug of changing string content
Checks
Context |
Check |
Description |
ci/Intel-dts-format-test |
success
|
Testing OK
|
ci/Intel-dts-pylama-test |
success
|
Testing OK
|
ci/Intel-dts-suite-test |
success
|
Testing OK
|
Commit Message
In history patch that add OUTPUT_DIR variable into initional function to
fix E1101 error that instance has no member error[pylint checking]. this
intruduce a bug, OUTPUT_DIR was defined in subclass as a property contained
a string , and when parent class initial, the OUTPUT_DIR attribute was
already exist and couldn't redefine again. this patch attempt to fix it
that through reflection mechanism to get the value instead of using
the variable directly and to avoid the E1101 error.
Signed-off-by: Jun Dong <junx.dong@intel.com>
---
framework/ixia_network/ixnet.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On Wed, 11 May 2022 14:14:15 +0800, Jun Dong <junx.dong@intel.com> wrote:
> In history patch that add OUTPUT_DIR variable into initional function to
> fix E1101 error that instance has no member error[pylint checking]. this
> intruduce a bug, OUTPUT_DIR was defined in subclass as a property contained
> a string , and when parent class initial, the OUTPUT_DIR attribute was
> already exist and couldn't redefine again. this patch attempt to fix it
> that through reflection mechanism to get the value instead of using
> the variable directly and to avoid the E1101 error.
>
> Signed-off-by: Jun Dong <junx.dong@intel.com>
Applied, thanks
@@ -70,7 +70,6 @@ class IxnetTrafficGenerator(object):
# initialize ixNetwork
self.new_blank_config()
self.tg_vports = self.assign_ports(self.tg_ports)
- self.OUTPUT_DIR = None
def get_session_id(self, api_server):
url = "{server}/api/v1/sessions".format(server=api_server)
@@ -746,7 +745,10 @@ class IxnetTrafficGenerator(object):
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
copy_to_path = os.sep.join(
- [self.OUTPUT_DIR, "ixnet" + datetime.now().strftime("%Y%m%d_%H%M%S")]
+ [
+ getattr(self, "OUTPUT_DIR"),
+ "ixnet" + datetime.now().strftime("%Y%m%d_%H%M%S"),
+ ]
)
if not os.path.exists(copy_to_path):
os.makedirs(copy_to_path)