You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2020/09/02 13:21:46 UTC

[incubator-ponymail-unit-tests] branch master updated: Only override gmtime for archiver.py

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git


The following commit(s) were added to refs/heads/master by this push:
     new 0557b35  Only override gmtime for archiver.py
0557b35 is described below

commit 0557b3531d52a01b37de4292f1cea6fd895e681b
Author: Sebb <se...@apache.org>
AuthorDate: Wed Sep 2 14:21:28 2020 +0100

    Only override gmtime for archiver.py
---
 tests/test-generators.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/test-generators.py b/tests/test-generators.py
index 9b3bff0..8a70bb7 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -158,9 +158,16 @@ def main():
 
     if os.environ.get('MOCK_GMTIME'):
         import time
+        import traceback
         save_gmtime = time.gmtime
         def _time_gmtime(secs=None):
-            return save_gmtime(secs or 0)
+            if secs is None:
+                callers = traceback.extract_stack(limit=1)
+                [filename, _, _, _] = callers[0]
+                if filename.endswith("/tools/archiver.py"):
+                    return save_gmtime(0)
+            return save_gmtime(secs)
+
         time.gmtime = _time_gmtime
     
     if args.generate: