commit 818ec7054910cb7db6cf87c5817abc01cb0b9814
parent f6a890f5cbcadf7dae3fa15397aa01eec3635df7
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Tue, 23 Aug 2022 18:36:15 +0200
autotests: Fix class variables that should be object vars
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.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git 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)