Verify we open a new file in the start method.
(filename)
| 22 | |
| 23 | @pytest.mark.parametrize("filename", [None, "out.txt"]) |
| 24 | def test_start(filename): |
| 25 | """Verify we open a new file in the start method.""" |
| 26 | mock_open = mock.mock_open() |
| 27 | formatter = base.BaseFormatter(options(output_file=filename)) |
| 28 | with mock.patch("flake8.formatting.base.open", mock_open): |
| 29 | formatter.start() |
| 30 | |
| 31 | if filename is None: |
| 32 | assert mock_open.called is False |
| 33 | else: |
| 34 | mock_open.assert_called_once_with(filename, "a") |
| 35 | |
| 36 | |
| 37 | def test_stop(): |