[Python-checkins] cpython: Added some diagnostics to help with #19690.

vinay.sajip python-checkins at python.org
Tue Dec 3 13:31:37 CET 2013


http://hg.python.org/cpython/rev/8fe3022af4b3
changeset:   87736:8fe3022af4b3
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Dec 03 12:31:23 2013 +0000
summary:
  Added some diagnostics to help with #19690.

files:
  Lib/test/test_logging.py |  13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -590,6 +590,7 @@
             for _ in range(tries):
                 try:
                     os.unlink(fname)
+                    self.deletion_time = time.time()
                 except OSError:
                     pass
                 time.sleep(0.004 * random.randint(0, 4))
@@ -597,6 +598,9 @@
         del_count = 500
         log_count = 500
 
+        self.handle_time = None
+        self.deletion_time = None
+
         for delay in (False, True):
             fd, fn = tempfile.mkstemp('.log', 'test_logging-3-')
             os.close(fd)
@@ -610,7 +614,14 @@
                 for _ in range(log_count):
                     time.sleep(0.005)
                     r = logging.makeLogRecord({'msg': 'testing' })
-                    h.handle(r)
+                    try:
+                        self.handle_time = time.time()
+                        h.handle(r)
+                    except Exception:
+                        print('Deleted at %s, '
+                              'opened at %s' % (self.deletion_time,
+                                                self.handle_time))
+                        raise
             finally:
                 remover.join()
                 h.close()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list