From 58603671c21b0af30d0d52fec862c5843c6e50d0 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 9 Aug 2018 13:45:55 +0200 Subject: Cleanup of class scoped variables After bug described in OS#3456 and fixed in last commit, let's categorize and place variables in its correct plac to avoid similar issus. We leave under the class keyword (class scoped variables) the attributes which are to be used as static class attributes. All other ones are initialized during __init__(). This way w avoid scenarios in which while using an object from an instance attribute we end up reading a class scoped variable which is shared among all instances. Change-Id: I5ad4cac34a9f49eaf42966c01c9c5a4d3f3e9dc8 --- src/osmo_gsm_tester/bts_osmo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/osmo_gsm_tester/bts_osmo.py') diff --git a/src/osmo_gsm_tester/bts_osmo.py b/src/osmo_gsm_tester/bts_osmo.py index b9b7fef..32784bd 100644 --- a/src/osmo_gsm_tester/bts_osmo.py +++ b/src/osmo_gsm_tester/bts_osmo.py @@ -24,14 +24,14 @@ from abc import ABCMeta, abstractmethod from . import log, config, util, template, process, bts, pcu_osmo class OsmoBts(bts.Bts, metaclass=ABCMeta): - proc_bts = None - _pcu = None ############## # PROTECTED ############## def __init__(self, suite_run, conf, name, defaults_cfg_name): super().__init__(suite_run, conf, name, defaults_cfg_name) + self._pcu = None + self.proc_bts = None if len(self.pcu_socket_path().encode()) > 107: raise log.Error('Path for pcu socket is longer than max allowed len for unix socket path (107):', self.pcu_socket_path()) @@ -75,9 +75,9 @@ class OsmoBtsMainUnit(OsmoBts, metaclass=ABCMeta): ############## # PROTECTED ############## - pcu_sk_tmp_dir = None def __init__(self, suite_run, conf, name, defaults_cfg_name): + self.pcu_sk_tmp_dir = None super().__init__(suite_run, conf, name, defaults_cfg_name) ######################## -- cgit v1.2.3