diff options
author | Xie Yanbo <xieyanbo@gmail.com> | 2020-07-24 07:10:50 +0800 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2020-07-23 19:13:19 -0400 |
commit | 224c73e34d80caebb34af1e06724fb7858ad732b (patch) | |
tree | 3746e43ed35104029814df4c4396319b1195cf14 | |
parent | db4213b6ac6c85a916f0d58792057ad79456e043 (diff) | |
download | python-coveragepy-git-224c73e34d80caebb34af1e06724fb7858ad732b.tar.gz |
Displaying timezone information in HTML report (#960)
* Displaying timezone information in HTML report
* A helpber to format datetime with local timezone
* No backward compatibility with older python versions
43 files changed, 64 insertions, 40 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 43beb35e..1ecbec24 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -28,6 +28,10 @@ Unreleased - The dark mode HTML report still used light colors for the context listing, making them unreadable (`issue 1009`_). This is now fixed. +- The time stamp on the HTML report now includes the time zone. Thanks, Xie + Yanbo (`pull request 960`_). + +.. _pull request 960: https://github.com/nedbat/coveragepy/pull/960 .. _issue 1009: https://github.com/nedbat/coveragepy/issues/1009 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 2219ae35..99b8493f 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -135,6 +135,7 @@ Thijs Triemstra Titus Brown Vince Salvino Ville Skyttä +Xie Yanbo Yury Selivanov Zac Hatfield-Dodds Zooko Wilcox-O'Hearn diff --git a/coverage/backward.py b/coverage/backward.py index 37b49167..9d1d78e5 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,17 @@ except ImportError: return self.__dict__ == other.__dict__ +def format_local_datetime(dt): + """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): + # Datetime.astimezone in Python 3.5 can not handle naive datetime + return dt.strftime('%Y-%m-%d %H:%M') + + 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 596e1143..3596bbe1 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -11,7 +11,7 @@ import shutil 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 @@ class HtmlReporter(object): '__url__': coverage.__url__, '__version__': coverage.__version__, 'title': title, - 'time_stamp': datetime.datetime.now().strftime('%Y-%m-%d %H:%M'), + 'time_stamp': format_local_datetime(datetime.datetime.now()), '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 d534c6a3..af5d72a1 100644 --- a/tests/gold/html/a/a_py.html +++ b/tests/gold/html/a/a_py.html @@ -61,7 +61,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/a/index.html b/tests/gold/html/a/index.html index e1c585fc..3276f1d6 100644 --- a/tests/gold/html/a/index.html +++ b/tests/gold/html/a/index.html @@ -76,7 +76,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/b_branch/b_py.html b/tests/gold/html/b_branch/b_py.html index 67a1b83b..ee28735e 100644 --- a/tests/gold/html/b_branch/b_py.html +++ b/tests/gold/html/b_branch/b_py.html @@ -84,7 +84,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/b_branch/index.html b/tests/gold/html/b_branch/index.html index 8b68b26e..0dfc20ca 100644 --- a/tests/gold/html/b_branch/index.html +++ b/tests/gold/html/b_branch/index.html @@ -84,7 +84,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/bom/2/bom_py.html b/tests/gold/html/bom/2/bom_py.html index 74f4f2fe..a6698845 100644 --- a/tests/gold/html/bom/2/bom_py.html +++ b/tests/gold/html/bom/2/bom_py.html @@ -67,7 +67,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:32 + created at 2019-10-14 09:32 +0000 </p> </div> </div> diff --git a/tests/gold/html/bom/2/index.html b/tests/gold/html/bom/2/index.html index 3fa67f0f..28abec0a 100644 --- a/tests/gold/html/bom/2/index.html +++ b/tests/gold/html/bom/2/index.html @@ -76,7 +76,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-13 11:41 + created at 2019-10-13 11:41 +0000 </p> </div> </div> diff --git a/tests/gold/html/bom/bom_py.html b/tests/gold/html/bom/bom_py.html index 10b84ede..3b181c63 100644 --- a/tests/gold/html/bom/bom_py.html +++ b/tests/gold/html/bom/bom_py.html @@ -67,7 +67,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/bom/index.html b/tests/gold/html/bom/index.html index b08e9c1c..0e56a99a 100644 --- a/tests/gold/html/bom/index.html +++ b/tests/gold/html/bom/index.html @@ -76,7 +76,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/isolatin1/index.html b/tests/gold/html/isolatin1/index.html index 7e33e754..ec9c50b5 100644 --- a/tests/gold/html/isolatin1/index.html +++ b/tests/gold/html/isolatin1/index.html @@ -76,7 +76,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/isolatin1/isolatin1_py.html b/tests/gold/html/isolatin1/isolatin1_py.html index b344bad6..3dd8c8fd 100644 --- a/tests/gold/html/isolatin1/isolatin1_py.html +++ b/tests/gold/html/isolatin1/isolatin1_py.html @@ -61,7 +61,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_1/index.html b/tests/gold/html/omit_1/index.html index d8d02f6a..a97add0f 100644 --- a/tests/gold/html/omit_1/index.html +++ b/tests/gold/html/omit_1/index.html @@ -97,7 +97,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_1/m1_py.html b/tests/gold/html/omit_1/m1_py.html index 57584495..94fba21e 100644 --- a/tests/gold/html/omit_1/m1_py.html +++ b/tests/gold/html/omit_1/m1_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_1/m2_py.html b/tests/gold/html/omit_1/m2_py.html index e8c1791d..ade526d3 100644 --- a/tests/gold/html/omit_1/m2_py.html +++ b/tests/gold/html/omit_1/m2_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_1/m3_py.html b/tests/gold/html/omit_1/m3_py.html index e714d47f..d6b4756d 100644 --- a/tests/gold/html/omit_1/m3_py.html +++ b/tests/gold/html/omit_1/m3_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_1/main_py.html b/tests/gold/html/omit_1/main_py.html index 28173d12..5d478124 100644 --- a/tests/gold/html/omit_1/main_py.html +++ b/tests/gold/html/omit_1/main_py.html @@ -66,7 +66,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_2/index.html b/tests/gold/html/omit_2/index.html index d51ebd2a..5b5e3c6e 100644 --- a/tests/gold/html/omit_2/index.html +++ b/tests/gold/html/omit_2/index.html @@ -90,7 +90,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_2/m2_py.html b/tests/gold/html/omit_2/m2_py.html index e8c1791d..ade526d3 100644 --- a/tests/gold/html/omit_2/m2_py.html +++ b/tests/gold/html/omit_2/m2_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_2/m3_py.html b/tests/gold/html/omit_2/m3_py.html index e714d47f..d6b4756d 100644 --- a/tests/gold/html/omit_2/m3_py.html +++ b/tests/gold/html/omit_2/m3_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_2/main_py.html b/tests/gold/html/omit_2/main_py.html index 28173d12..5d478124 100644 --- a/tests/gold/html/omit_2/main_py.html +++ b/tests/gold/html/omit_2/main_py.html @@ -66,7 +66,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_3/index.html b/tests/gold/html/omit_3/index.html index 0d8ff217..f5bc1aae 100644 --- a/tests/gold/html/omit_3/index.html +++ b/tests/gold/html/omit_3/index.html @@ -83,7 +83,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_3/m3_py.html b/tests/gold/html/omit_3/m3_py.html index e714d47f..d6b4756d 100644 --- a/tests/gold/html/omit_3/m3_py.html +++ b/tests/gold/html/omit_3/m3_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_3/main_py.html b/tests/gold/html/omit_3/main_py.html index 28173d12..5d478124 100644 --- a/tests/gold/html/omit_3/main_py.html +++ b/tests/gold/html/omit_3/main_py.html @@ -66,7 +66,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_4/index.html b/tests/gold/html/omit_4/index.html index d91291fc..861ba02e 100644 --- a/tests/gold/html/omit_4/index.html +++ b/tests/gold/html/omit_4/index.html @@ -90,7 +90,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_4/m1_py.html b/tests/gold/html/omit_4/m1_py.html index 57584495..94fba21e 100644 --- a/tests/gold/html/omit_4/m1_py.html +++ b/tests/gold/html/omit_4/m1_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_4/m3_py.html b/tests/gold/html/omit_4/m3_py.html index e714d47f..d6b4756d 100644 --- a/tests/gold/html/omit_4/m3_py.html +++ b/tests/gold/html/omit_4/m3_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_4/main_py.html b/tests/gold/html/omit_4/main_py.html index 28173d12..5d478124 100644 --- a/tests/gold/html/omit_4/main_py.html +++ b/tests/gold/html/omit_4/main_py.html @@ -66,7 +66,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_5/index.html b/tests/gold/html/omit_5/index.html index f1e0fe60..8afbebad 100644 --- a/tests/gold/html/omit_5/index.html +++ b/tests/gold/html/omit_5/index.html @@ -83,7 +83,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_5/m1_py.html b/tests/gold/html/omit_5/m1_py.html index 57584495..94fba21e 100644 --- a/tests/gold/html/omit_5/m1_py.html +++ b/tests/gold/html/omit_5/m1_py.html @@ -58,7 +58,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/omit_5/main_py.html b/tests/gold/html/omit_5/main_py.html index 28173d12..5d478124 100644 --- a/tests/gold/html/omit_5/main_py.html +++ b/tests/gold/html/omit_5/main_py.html @@ -66,7 +66,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/other/blah_blah_other_py.html b/tests/gold/html/other/blah_blah_other_py.html index 8f0309d4..d88e21e5 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 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/other/here_py.html b/tests/gold/html/other/here_py.html index c2f6b5f1..94491fb0 100644 --- a/tests/gold/html/other/here_py.html +++ b/tests/gold/html/other/here_py.html @@ -62,7 +62,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/other/index.html b/tests/gold/html/other/index.html index fa1a770f..644d1490 100644 --- a/tests/gold/html/other/index.html +++ b/tests/gold/html/other/index.html @@ -83,7 +83,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/partial/index.html b/tests/gold/html/partial/index.html index fa1ec4ad..f766c0b4 100644 --- a/tests/gold/html/partial/index.html +++ b/tests/gold/html/partial/index.html @@ -84,7 +84,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 12:01 + created at 2019-10-14 12:01 +0000 </p> </div> </div> diff --git a/tests/gold/html/partial/partial_py.html b/tests/gold/html/partial/partial_py.html index abd755d0..c301a58a 100644 --- a/tests/gold/html/partial/partial_py.html +++ b/tests/gold/html/partial/partial_py.html @@ -74,7 +74,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 12:01 + created at 2019-10-14 12:01 +0000 </p> </div> </div> diff --git a/tests/gold/html/styled/a_py.html b/tests/gold/html/styled/a_py.html index 7b6f9dcd..b81641cc 100644 --- a/tests/gold/html/styled/a_py.html +++ b/tests/gold/html/styled/a_py.html @@ -62,7 +62,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/styled/index.html b/tests/gold/html/styled/index.html index 6e182fa6..d1a9259b 100644 --- a/tests/gold/html/styled/index.html +++ b/tests/gold/html/styled/index.html @@ -77,7 +77,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/unicode/index.html b/tests/gold/html/unicode/index.html index bfa09a38..b2de7b3d 100644 --- a/tests/gold/html/unicode/index.html +++ b/tests/gold/html/unicode/index.html @@ -76,7 +76,7 @@ <div class="content"> <p> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/gold/html/unicode/unicode_py.html b/tests/gold/html/unicode/unicode_py.html index a4218bcc..311427d3 100644 --- a/tests/gold/html/unicode/unicode_py.html +++ b/tests/gold/html/unicode/unicode_py.html @@ -61,7 +61,7 @@ <div class="content"> <p> <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a9">coverage.py v5.0a9</a>, - created at 2019-10-14 09:27 + created at 2019-10-14 09:27 +0000 </p> </div> </div> diff --git a/tests/test_html.py b/tests/test_html.py index b543fa08..6f22acc0 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -71,6 +71,11 @@ class HtmlTestHelpers(CoverageTest): 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} \+\d{4}", + 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, @@ -620,6 +625,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 [-+]\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'<span class="(nam|key)">(print|True|False)</span>', r'<span class="nam">\2</span>'), |