Change in osmo-gsm-tester[master]: test: Move duration time calculation to helper function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Jun 12 14:38:41 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18796 )


Change subject: test: Move duration time calculation to helper function
......................................................................

test: Move duration time calculation to helper function

Change-Id: Ica2e7d92f37d18a4f8832f38d9f9f3baba8be09f
---
M src/osmo_gsm_tester/core/test.py
1 file changed, 6 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/96/18796/1

diff --git a/src/osmo_gsm_tester/core/test.py b/src/osmo_gsm_tester/core/test.py
index 47e1f42..7347229 100644
--- a/src/osmo_gsm_tester/core/test.py
+++ b/src/osmo_gsm_tester/core/test.py
@@ -105,9 +105,13 @@
             return '%s:%s' % (self._name, l)
         return super().name()
 
+    def elapsed_time(self):
+        'time elapsed since test was started'
+        return time.time() - self.start_timestamp
+
     def set_fail(self, fail_type, fail_message, tb_str=None, src=4):
         self.status = Test.FAIL
-        self.duration = time.time() - self.start_timestamp
+        self.duration = self.elapsed_time()
         self.fail_type = fail_type
         self.fail_message = fail_message
 
@@ -123,7 +127,7 @@
 
     def set_pass(self):
         self.status = Test.PASS
-        self.duration = time.time() - self.start_timestamp
+        self.duration = self.elapsed_time()
         self.log('Test passed (%.1f sec)' % self.duration)
 
     def set_skip(self):

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18796
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: Ica2e7d92f37d18a4f8832f38d9f9f3baba8be09f
Gerrit-Change-Number: 18796
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200612/f29482eb/attachment.htm>


More information about the gerrit-log mailing list