From f5e5b4ac41f77891dd8d7b1b303568ad3758c646 Mon Sep 17 00:00:00 2001 From: Xie Yanbo Date: Thu, 19 Mar 2020 15:14:45 +0800 Subject: [PATCH 1/3] Displaying timezone information in HTML report --- coverage/html.py | 2 +- tests/gold/html/a/a_py.html | 2 +- tests/gold/html/a/index.html | 2 +- tests/gold/html/b_branch/b_py.html | 2 +- tests/gold/html/b_branch/index.html | 2 +- tests/gold/html/bom/2/bom_py.html | 2 +- tests/gold/html/bom/2/index.html | 2 +- tests/gold/html/bom/bom_py.html | 2 +- tests/gold/html/bom/index.html | 2 +- tests/gold/html/isolatin1/index.html | 2 +- tests/gold/html/isolatin1/isolatin1_py.html | 2 +- tests/gold/html/omit_1/index.html | 2 +- tests/gold/html/omit_1/m1_py.html | 2 +- tests/gold/html/omit_1/m2_py.html | 2 +- tests/gold/html/omit_1/m3_py.html | 2 +- tests/gold/html/omit_1/main_py.html | 2 +- tests/gold/html/omit_2/index.html | 2 +- tests/gold/html/omit_2/m2_py.html | 2 +- tests/gold/html/omit_2/m3_py.html | 2 +- tests/gold/html/omit_2/main_py.html | 2 +- tests/gold/html/omit_3/index.html | 2 +- tests/gold/html/omit_3/m3_py.html | 2 +- tests/gold/html/omit_3/main_py.html | 2 +- tests/gold/html/omit_4/index.html | 2 +- tests/gold/html/omit_4/m1_py.html | 2 +- tests/gold/html/omit_4/m3_py.html | 2 +- tests/gold/html/omit_4/main_py.html | 2 +- tests/gold/html/omit_5/index.html | 2 +- tests/gold/html/omit_5/m1_py.html | 2 +- tests/gold/html/omit_5/main_py.html | 2 +- tests/gold/html/other/blah_blah_other_py.html | 2 +- tests/gold/html/other/here_py.html | 2 +- tests/gold/html/other/index.html | 2 +- tests/gold/html/partial/index.html | 2 +- tests/gold/html/partial/partial_py.html | 2 +- tests/gold/html/styled/a_py.html | 2 +- tests/gold/html/styled/index.html | 2 +- tests/gold/html/unicode/index.html | 2 +- tests/gold/html/unicode/unicode_py.html | 2 +- tests/test_html.py | 6 +++--- 40 files changed, 42 insertions(+), 42 deletions(-) diff --git a/coverage/html.py b/coverage/html.py index 596e11435..a8aa3f654 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -200,7 +200,7 @@ def __init__(self, cov): '__url__': coverage.__url__, '__version__': coverage.__version__, 'title': title, - 'time_stamp': datetime.datetime.now().strftime('%Y-%m-%d %H:%M'), + 'time_stamp': datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M %z'), 'extra_css': self.extra_css, 'has_arcs': self.has_arcs, 'show_contexts': self.config.show_contexts, diff --git a/tests/gold/html/a/a_py.html b/tests/gold/html/a/a_py.html index 2ce524140..9cfb74544 100644 --- a/tests/gold/html/a/a_py.html +++ b/tests/gold/html/a/a_py.html @@ -61,7 +61,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/a/index.html b/tests/gold/html/a/index.html index e1c585fc9..3276f1d65 100644 --- a/tests/gold/html/a/index.html +++ b/tests/gold/html/a/index.html @@ -76,7 +76,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/b_branch/b_py.html b/tests/gold/html/b_branch/b_py.html index ce8bb875e..39a7a9b79 100644 --- a/tests/gold/html/b_branch/b_py.html +++ b/tests/gold/html/b_branch/b_py.html @@ -84,7 +84,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/b_branch/index.html b/tests/gold/html/b_branch/index.html index 8b68b26e2..0dfc20cad 100644 --- a/tests/gold/html/b_branch/index.html +++ b/tests/gold/html/b_branch/index.html @@ -84,7 +84,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/bom/2/bom_py.html b/tests/gold/html/bom/2/bom_py.html index 3d1c98fbd..8802ece8c 100644 --- a/tests/gold/html/bom/2/bom_py.html +++ b/tests/gold/html/bom/2/bom_py.html @@ -67,7 +67,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:32 + created at 2019-10-14 09:32 +0000

diff --git a/tests/gold/html/bom/2/index.html b/tests/gold/html/bom/2/index.html index 3fa67f0fa..28abec0a6 100644 --- a/tests/gold/html/bom/2/index.html +++ b/tests/gold/html/bom/2/index.html @@ -76,7 +76,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-13 11:41 + created at 2019-10-13 11:41 +0000

diff --git a/tests/gold/html/bom/bom_py.html b/tests/gold/html/bom/bom_py.html index 635f8b514..63679d4bc 100644 --- a/tests/gold/html/bom/bom_py.html +++ b/tests/gold/html/bom/bom_py.html @@ -67,7 +67,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/bom/index.html b/tests/gold/html/bom/index.html index b08e9c1c9..0e56a99a6 100644 --- a/tests/gold/html/bom/index.html +++ b/tests/gold/html/bom/index.html @@ -76,7 +76,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/isolatin1/index.html b/tests/gold/html/isolatin1/index.html index 7e33e754d..ec9c50b52 100644 --- a/tests/gold/html/isolatin1/index.html +++ b/tests/gold/html/isolatin1/index.html @@ -76,7 +76,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/isolatin1/isolatin1_py.html b/tests/gold/html/isolatin1/isolatin1_py.html index 9c12c445d..549c55cc8 100644 --- a/tests/gold/html/isolatin1/isolatin1_py.html +++ b/tests/gold/html/isolatin1/isolatin1_py.html @@ -61,7 +61,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_1/index.html b/tests/gold/html/omit_1/index.html index d8d02f6ab..a97add0f6 100644 --- a/tests/gold/html/omit_1/index.html +++ b/tests/gold/html/omit_1/index.html @@ -97,7 +97,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_1/m1_py.html b/tests/gold/html/omit_1/m1_py.html index 60923930b..8dcafac8d 100644 --- a/tests/gold/html/omit_1/m1_py.html +++ b/tests/gold/html/omit_1/m1_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_1/m2_py.html b/tests/gold/html/omit_1/m2_py.html index de060f321..1545dc0b4 100644 --- a/tests/gold/html/omit_1/m2_py.html +++ b/tests/gold/html/omit_1/m2_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_1/m3_py.html b/tests/gold/html/omit_1/m3_py.html index 76a91a4a9..f49336eb6 100644 --- a/tests/gold/html/omit_1/m3_py.html +++ b/tests/gold/html/omit_1/m3_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_1/main_py.html b/tests/gold/html/omit_1/main_py.html index 9f242537f..d0c8ba2b0 100644 --- a/tests/gold/html/omit_1/main_py.html +++ b/tests/gold/html/omit_1/main_py.html @@ -66,7 +66,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_2/index.html b/tests/gold/html/omit_2/index.html index d51ebd2a9..5b5e3c6ea 100644 --- a/tests/gold/html/omit_2/index.html +++ b/tests/gold/html/omit_2/index.html @@ -90,7 +90,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_2/m2_py.html b/tests/gold/html/omit_2/m2_py.html index de060f321..1545dc0b4 100644 --- a/tests/gold/html/omit_2/m2_py.html +++ b/tests/gold/html/omit_2/m2_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_2/m3_py.html b/tests/gold/html/omit_2/m3_py.html index 76a91a4a9..f49336eb6 100644 --- a/tests/gold/html/omit_2/m3_py.html +++ b/tests/gold/html/omit_2/m3_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_2/main_py.html b/tests/gold/html/omit_2/main_py.html index 9f242537f..d0c8ba2b0 100644 --- a/tests/gold/html/omit_2/main_py.html +++ b/tests/gold/html/omit_2/main_py.html @@ -66,7 +66,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_3/index.html b/tests/gold/html/omit_3/index.html index 0d8ff217d..f5bc1aaeb 100644 --- a/tests/gold/html/omit_3/index.html +++ b/tests/gold/html/omit_3/index.html @@ -83,7 +83,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_3/m3_py.html b/tests/gold/html/omit_3/m3_py.html index 76a91a4a9..f49336eb6 100644 --- a/tests/gold/html/omit_3/m3_py.html +++ b/tests/gold/html/omit_3/m3_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_3/main_py.html b/tests/gold/html/omit_3/main_py.html index 9f242537f..d0c8ba2b0 100644 --- a/tests/gold/html/omit_3/main_py.html +++ b/tests/gold/html/omit_3/main_py.html @@ -66,7 +66,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_4/index.html b/tests/gold/html/omit_4/index.html index d91291fc4..861ba02e3 100644 --- a/tests/gold/html/omit_4/index.html +++ b/tests/gold/html/omit_4/index.html @@ -90,7 +90,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_4/m1_py.html b/tests/gold/html/omit_4/m1_py.html index 60923930b..8dcafac8d 100644 --- a/tests/gold/html/omit_4/m1_py.html +++ b/tests/gold/html/omit_4/m1_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_4/m3_py.html b/tests/gold/html/omit_4/m3_py.html index 76a91a4a9..f49336eb6 100644 --- a/tests/gold/html/omit_4/m3_py.html +++ b/tests/gold/html/omit_4/m3_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_4/main_py.html b/tests/gold/html/omit_4/main_py.html index 9f242537f..d0c8ba2b0 100644 --- a/tests/gold/html/omit_4/main_py.html +++ b/tests/gold/html/omit_4/main_py.html @@ -66,7 +66,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_5/index.html b/tests/gold/html/omit_5/index.html index f1e0fe605..8afbebad5 100644 --- a/tests/gold/html/omit_5/index.html +++ b/tests/gold/html/omit_5/index.html @@ -83,7 +83,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_5/m1_py.html b/tests/gold/html/omit_5/m1_py.html index 60923930b..8dcafac8d 100644 --- a/tests/gold/html/omit_5/m1_py.html +++ b/tests/gold/html/omit_5/m1_py.html @@ -58,7 +58,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/omit_5/main_py.html b/tests/gold/html/omit_5/main_py.html index 9f242537f..d0c8ba2b0 100644 --- a/tests/gold/html/omit_5/main_py.html +++ b/tests/gold/html/omit_5/main_py.html @@ -66,7 +66,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/other/blah_blah_other_py.html b/tests/gold/html/other/blah_blah_other_py.html index d3a4ebfc3..3774fdd4f 100644 --- a/tests/gold/html/other/blah_blah_other_py.html +++ b/tests/gold/html/other/blah_blah_other_py.html @@ -60,7 +60,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/other/here_py.html b/tests/gold/html/other/here_py.html index df2715d6f..2693ac584 100644 --- a/tests/gold/html/other/here_py.html +++ b/tests/gold/html/other/here_py.html @@ -62,7 +62,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/other/index.html b/tests/gold/html/other/index.html index fa1a770f4..644d14909 100644 --- a/tests/gold/html/other/index.html +++ b/tests/gold/html/other/index.html @@ -83,7 +83,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/partial/index.html b/tests/gold/html/partial/index.html index fa1ec4ad9..f766c0b4c 100644 --- a/tests/gold/html/partial/index.html +++ b/tests/gold/html/partial/index.html @@ -84,7 +84,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 12:01 + created at 2019-10-14 12:01 +0000

diff --git a/tests/gold/html/partial/partial_py.html b/tests/gold/html/partial/partial_py.html index f004808a2..e47cd9685 100644 --- a/tests/gold/html/partial/partial_py.html +++ b/tests/gold/html/partial/partial_py.html @@ -74,7 +74,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 12:01 + created at 2019-10-14 12:01 +0000

diff --git a/tests/gold/html/styled/a_py.html b/tests/gold/html/styled/a_py.html index 4687e4642..51a7389f6 100644 --- a/tests/gold/html/styled/a_py.html +++ b/tests/gold/html/styled/a_py.html @@ -62,7 +62,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/styled/index.html b/tests/gold/html/styled/index.html index 6e182fa63..d1a9259b6 100644 --- a/tests/gold/html/styled/index.html +++ b/tests/gold/html/styled/index.html @@ -77,7 +77,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/unicode/index.html b/tests/gold/html/unicode/index.html index bfa09a38d..b2de7b3d1 100644 --- a/tests/gold/html/unicode/index.html +++ b/tests/gold/html/unicode/index.html @@ -76,7 +76,7 @@

Coverage report:

coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/gold/html/unicode/unicode_py.html b/tests/gold/html/unicode/unicode_py.html index 467229616..40280ad5f 100644 --- a/tests/gold/html/unicode/unicode_py.html +++ b/tests/gold/html/unicode/unicode_py.html @@ -61,7 +61,7 @@

« index     coverage.py v5.0a9, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000

diff --git a/tests/test_html.py b/tests/test_html.py index b543fa08e..ef78693e7 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -71,8 +71,8 @@ def get_html_index_content(self): with open("htmlcov/index.html") as f: index = f.read() index = re.sub( - r"created at \d{4}-\d{2}-\d{2} \d{2}:\d{2}", - r"created at YYYY-MM-DD HH:MM", + r"created at \d{4}-\d{2}-\d{2} \d{2}:\d{2} \+\d{4}", + r"created at YYYY-MM-DD HH:MM +ZZZZ", index, ) return index @@ -620,7 +620,7 @@ def compare_html(expected, actual): scrubs = [ (r'/coverage.readthedocs.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'), (r'coverage.py v[\d.abc]+', 'coverage.py vVER'), - (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d', 'created at DATE'), + (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d \+\d\d\d\d', 'created at DATE'), # Some words are identifiers in one version, keywords in another. (r'(print|True|False)', r'\2'), # Occasionally an absolute path is in the HTML report. From 4b184899062c70f5c673f2286e3b7a7c8fde6e76 Mon Sep 17 00:00:00 2001 From: Xie Yanbo Date: Thu, 19 Mar 2020 18:09:21 +0800 Subject: [PATCH 2/3] A helpber to format datetime with local timezone --- coverage/backward.py | 26 ++++++++++++++++++++++++++ coverage/html.py | 4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/coverage/backward.py b/coverage/backward.py index 37b491676..92b0cf70a 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -9,6 +9,8 @@ import os import sys +from datetime import datetime + from coverage import env @@ -217,6 +219,30 @@ def __eq__(self, other): return self.__dict__ == other.__dict__ +def format_local_datetime(dt): + """Return a string with local timezone representing the date.""" + try: + return dt.astimezone().strftime('%Y-%m-%d %H:%M %z') + except (TypeError, ValueError): + # Class datetime.timezone introduced in Python 3.2 + # Datetime.astimezone in Python 3.5 can not handle naive datetime + import time + def get_timezone_offset(): + timestamp = time.time() + delta = datetime.fromtimestamp(timestamp) - datetime.utcfromtimestamp(timestamp) + if delta.seconds >= 0: + sign = '+' + seconds = delta.seconds + else: + sign = '-' + seconds = - delta.seconds + hours, rest = divmod(seconds, 60 * 60) + minutes, _ = divmod(rest, 60) + return '%s%02d%02d' % (sign, hours, minutes) + offset = get_timezone_offset() + return '%s %s' % (dt.strftime('%Y-%m-%d %H:%M'), offset) + + def invalidate_import_caches(): """Invalidate any import caches that may or may not exist.""" if importlib and hasattr(importlib, "invalidate_caches"): diff --git a/coverage/html.py b/coverage/html.py index a8aa3f654..3596bbe1d 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -11,7 +11,7 @@ import coverage from coverage import env -from coverage.backward import iitems, SimpleNamespace +from coverage.backward import iitems, SimpleNamespace, format_local_datetime from coverage.data import add_data_to_hash from coverage.files import flat_rootname from coverage.misc import CoverageException, ensure_dir, file_be_gone, Hasher, isolate_module @@ -200,7 +200,7 @@ def __init__(self, cov): '__url__': coverage.__url__, '__version__': coverage.__version__, 'title': title, - 'time_stamp': datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M %z'), + 'time_stamp': format_local_datetime(datetime.datetime.now()), 'extra_css': self.extra_css, 'has_arcs': self.has_arcs, 'show_contexts': self.config.show_contexts, From d66983d474e5d073b3f8181e6a52d6ce15fef75c Mon Sep 17 00:00:00 2001 From: Xie Yanbo Date: Sun, 19 Jul 2020 19:08:07 +0800 Subject: [PATCH 3/3] No backward compatibility with older python versions --- coverage/backward.py | 21 ++++----------------- tests/test_html.py | 6 ++++++ 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/coverage/backward.py b/coverage/backward.py index 92b0cf70a..9d1d78e5b 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -220,27 +220,14 @@ def __eq__(self, other): def format_local_datetime(dt): - """Return a string with local timezone representing the date.""" + """Return a string with local timezone representing the date. + If python version is lower than 3.6, the time zone is not included. + """ try: return dt.astimezone().strftime('%Y-%m-%d %H:%M %z') except (TypeError, ValueError): - # Class datetime.timezone introduced in Python 3.2 # Datetime.astimezone in Python 3.5 can not handle naive datetime - import time - def get_timezone_offset(): - timestamp = time.time() - delta = datetime.fromtimestamp(timestamp) - datetime.utcfromtimestamp(timestamp) - if delta.seconds >= 0: - sign = '+' - seconds = delta.seconds - else: - sign = '-' - seconds = - delta.seconds - hours, rest = divmod(seconds, 60 * 60) - minutes, _ = divmod(rest, 60) - return '%s%02d%02d' % (sign, hours, minutes) - offset = get_timezone_offset() - return '%s %s' % (dt.strftime('%Y-%m-%d %H:%M'), offset) + return dt.strftime('%Y-%m-%d %H:%M') def invalidate_import_caches(): diff --git a/tests/test_html.py b/tests/test_html.py index ef78693e7..0c003016f 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -75,6 +75,11 @@ def get_html_index_content(self): r"created at YYYY-MM-DD HH:MM +ZZZZ", index, ) + index = re.sub( + r"created at \d{4}-\d{2}-\d{2} \d{2}:\d{2}", + r"created at YYYY-MM-DD HH:MM", + index, + ) return index def assert_correct_timestamp(self, html): @@ -621,6 +626,7 @@ def compare_html(expected, actual): (r'/coverage.readthedocs.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'), (r'coverage.py v[\d.abc]+', 'coverage.py vVER'), (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d \+\d\d\d\d', 'created at DATE'), + (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d', 'created at DATE'), # Some words are identifiers in one version, keywords in another. (r'(print|True|False)', r'\2'), # Occasionally an absolute path is in the HTML report.