diff mbox series

[2/3] autotests: Fix class variables that should be object vars

Message ID 20220823163616.1466543-2-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/3] autotests: Fix testNetconfig ACD test | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Andrew Zaborowski Aug. 23, 2022, 4:36 p.m. UTC
Due to those variables being global (IWD class variables) calling either
unregister_psk_agent or del on one IWD class instance would unregister
all agents on all instances.  Move .psk_agents and two other class
variables to the object.  They were already referenced using "self."
as if they were object variables throughout the class.
---
 autotests/util/iwd.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index b17fe163..5f5699df 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -1091,17 +1091,15 @@  class IWD(AsyncOpAbstract):
         some tests do require starting IWD using this constructor (by passing
         start_iwd_daemon=True)
     '''
-    _object_manager_if = None
-    _iwd_proc = None
-    _devices = None
     _default_instance = None
-    psk_agents = []
 
     def __init__(self, start_iwd_daemon = False, iwd_config_dir = '/tmp',
                             iwd_storage_dir = IWD_STORAGE_DIR, namespace=ctx,
                             developer_mode = True):
         self.namespace = namespace
         self._bus = namespace.get_bus()
+        self._object_manager_if = None
+        self._iwd_proc = None
 
         if start_iwd_daemon:
             if self.namespace.is_process_running('iwd'):
@@ -1120,6 +1118,8 @@  class IWD(AsyncOpAbstract):
         if self.namespace.name is None:
             IWD._default_instance = weakref.ref(self)
 
+        self.psk_agents = []
+
     def __del__(self):
         for agent in self.psk_agents:
             self.unregister_psk_agent(agent)