Change in osmo-gsm-tester[master]: suite: Make _processes an empty list during init time

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Apr 4 16:10:33 UTC 2019


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/13528 )

Change subject: suite: Make _processes an empty list during init time
......................................................................

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
---
M src/osmo_gsm_tester/suite.py
1 file changed, 10 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved



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 @@
         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 @@
         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 @@
         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!'

-- 
To view, visit https://gerrit.osmocom.org/13528
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I634901a1f4ba3a6b7294666012ea679ae148ff08
Gerrit-Change-Number: 13528
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190404/c453d053/attachment.html>


More information about the gerrit-log mailing list