summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-29 23:31:41 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-29 23:31:41 +0000
commite619fd3b2095a4951ecd1cfceab195e6f501f8ee (patch)
tree3b2d75b5aedc6052e23fdcc1288db8d53b43d8a6
parent971dcc16f081203ec0374c50a75b84d8cc089025 (diff)
parente93aad6043f870d04648e7e0af983248ec60c9ef (diff)
downloadflake8-e619fd3b2095a4951ecd1cfceab195e6f501f8ee.tar.gz
Merge branch 'bug/193' into 'master'
Open our output file in append mode always *Description of changes* *Related to:* #193 See merge request !108
-rw-r--r--docs/source/release-notes/3.0.3.rst10
-rw-r--r--src/flake8/formatting/base.py2
-rw-r--r--tests/unit/test_base_formatter.py2
3 files changed, 10 insertions, 4 deletions
diff --git a/docs/source/release-notes/3.0.3.rst b/docs/source/release-notes/3.0.3.rst
index 17a13b1..92252ac 100644
--- a/docs/source/release-notes/3.0.3.rst
+++ b/docs/source/release-notes/3.0.3.rst
@@ -16,12 +16,18 @@
not updated for the current version of flake8. This is nicer than raising a
`PicklingError` about failing to pickle a module (See also `GitLab#164`_)
+- Always open our output file in append mode so we do not overwrite log
+ messages. (See also `GitLab#193`_)
+
+
.. links
+.. _GitLab#164:
+ https://gitlab.com/pycqa/flake8/issues/164
.. _GitLab#178:
https://gitlab.com/pycqa/flake8/issues/178
+.. _GitLab#193:
+ https://gitlab.com/pycqa/flake8/issues/193
.. _GitLab#195:
https://gitlab.com/pycqa/flake8/issues/195
.. _this Python bug report:
https://bugs.python.org/issue27649
-.. _GitLab#164:
- https://gitlab.com/pycqa/flake8/issues/164
diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py
index 336bf50..97c60e1 100644
--- a/src/flake8/formatting/base.py
+++ b/src/flake8/formatting/base.py
@@ -50,7 +50,7 @@ class BaseFormatter(object):
This defaults to initializing :attr:`output_fd` if :attr:`filename`
"""
if self.filename:
- self.output_fd = open(self.filename, 'w')
+ self.output_fd = open(self.filename, 'a')
def handle(self, error):
"""Handle an error reported by Flake8.
diff --git a/tests/unit/test_base_formatter.py b/tests/unit/test_base_formatter.py
index ae5c12a..8a99fa6 100644
--- a/tests/unit/test_base_formatter.py
+++ b/tests/unit/test_base_formatter.py
@@ -25,7 +25,7 @@ def test_start(filename):
if filename is None:
assert mock_open.called is False
else:
- mock_open.assert_called_once_with(filename, 'w')
+ mock_open.assert_called_once_with(filename, 'a')
def test_stop():