File tree 3 files changed +11
-0
lines changed
3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ Unreleased
37
37
a ``-q/--quiet `` option to suppress the messages they write to stdout about
38
38
what they are doing (`issue 1254 `_).
39
39
40
+ - Feature: The ``html `` command writes a ``.gitignore `` file into the HTML
41
+ output directory, to prevent the report from being committed to git. If you
42
+ want to commit it, you will need to delete that file. Closes `issue 1244 `_.
43
+
40
44
- Feature: Added support for PyPy 3.8.
41
45
42
46
- Fix: more generated code is now excluded from measurement. Code such as
@@ -58,6 +62,7 @@ Unreleased
58
62
.. _issue 553 : https://github.com/nedbat/coveragepy/issues/553
59
63
.. _issue 840 : https://github.com/nedbat/coveragepy/issues/840
60
64
.. _issue 1160 : https://github.com/nedbat/coveragepy/issues/1160
65
+ .. _issue 1244 : https://github.com/nedbat/coveragepy/issues/1244
61
66
.. _issue 1254 : https://github.com/nedbat/coveragepy/issues/1254
62
67
.. _attrs : https://www.attrs.org/
63
68
Original file line number Diff line number Diff line change @@ -224,6 +224,11 @@ def make_local_static_report_files(self):
224
224
for static in self .STATIC_FILES :
225
225
shutil .copyfile (data_filename (static ), os .path .join (self .directory , static ))
226
226
227
+ # .gitignore can't be copied from the source tree because it would
228
+ # prevent the static files from being checked in.
229
+ with open (os .path .join (self .directory , ".gitignore" ), "w" ) as fgi :
230
+ fgi .write ("# Created by coverage.py\n *\n " )
231
+
227
232
# The user may have extra CSS they want copied.
228
233
if self .extra_css :
229
234
shutil .copyfile (self .config .extra_css , os .path .join (self .directory , self .extra_css ))
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ def assert_htmlcov_files_exist(self):
144
144
self .assert_exists ("htmlcov/helper2_py.html" )
145
145
self .assert_exists ("htmlcov/style.css" )
146
146
self .assert_exists ("htmlcov/coverage_html.js" )
147
+ self .assert_exists ("htmlcov/.gitignore" )
147
148
148
149
def test_html_created (self ):
149
150
# Test basic HTML generation: files should be created.
You can’t perform that action at this time.
0 commit comments