test suite reviews and discussions
 help / color / mirror / Atom feed
From: Jun Dong <junx.dong@intel.com>
To: dts@dpdk.org
Cc: lijuan.tu@intel.com, qingx.sun@intel.com, junx.dong@intel.com
Subject: [dts] [V1] ixia_network/ixnet: fix bug of changing string content
Date: Wed, 11 May 2022 14:14:15 +0800	[thread overview]
Message-ID: <20220511061415.3665-1-junx.dong@intel.com> (raw)

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(-)

diff --git a/framework/ixia_network/ixnet.py b/framework/ixia_network/ixnet.py
index 08aaf568..5d54fa30 100644
--- a/framework/ixia_network/ixnet.py
+++ b/framework/ixia_network/ixnet.py
@@ -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)
-- 
2.33.1.windows.1


             reply	other threads:[~2022-05-11  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  6:14 Jun Dong [this message]
2022-05-18  9:12 ` lijuan.tu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511061415.3665-1-junx.dong@intel.com \
    --to=junx.dong@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    --cc=qingx.sun@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).