summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-04-04 17:44:33 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-04-04 17:44:37 +0200
commit806aae88306a3c724a162c39a930b40361724f42 (patch)
tree70abfb4dc176606fee979ead7368bfbda057bbeb
parent4c8cd7b9a58d9100fe49b16f281ff24d3e7f81db (diff)
suite: Make _processes an empty list during init time
It simplifies the code because we don't need to check if it is a list or not. Change-Id: I634901a1f4ba3a6b7294666012ea679ae148ff08
-rw-r--r--src/osmo_gsm_tester/suite.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index aefdc24..85eca46 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -73,7 +73,7 @@ class SuiteRun(log.Origin):
self._resource_requirements = None
self._resource_modifiers = None
self._config = None
- self._processes = None
+ self._processes = []
self._run_dir = None
self.trial = trial
self.definition = suite_definition
@@ -241,8 +241,6 @@ class SuiteRun(log.Origin):
process managed by suite finishes before cleanup time, the current test
will be marked as FAIL and end immediatelly. If respwan=True, then suite
will respawn() the process instead.'''
- if self._processes is None:
- self._processes = []
self._processes.insert(0, (process, respawn))
def stop_processes(self):
@@ -396,16 +394,15 @@ class SuiteRun(log.Origin):
return bvci
def poll(self):
- if self._processes:
- for proc, respawn in self._processes:
- if proc.terminated():
- if respawn == True:
- proc.respawn()
- else:
- proc.log_stdout_tail()
- proc.log_stderr_tail()
- log.ctx(proc)
- raise log.Error('Process ended prematurely: %s' % proc.name())
+ for proc, respawn in self._processes:
+ if proc.terminated():
+ if respawn == True:
+ proc.respawn()
+ else:
+ proc.log_stdout_tail()
+ proc.log_stderr_tail()
+ log.ctx(proc)
+ raise log.Error('Process ended prematurely: %s' % proc.name())
def prompt(self, *msgs, **msg_details):
'ask for user interaction. Do not use in tests that should run automatically!'