summaryrefslogtreecommitdiff
path: root/tests/integration/test_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_main.py')
-rw-r--r--tests/integration/test_main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py
index b67992b..54254ef 100644
--- a/tests/integration/test_main.py
+++ b/tests/integration/test_main.py
@@ -246,3 +246,17 @@ def test_file_not_found(tmpdir, capsys):
out, err = capsys.readouterr()
assert out.startswith("i-do-not-exist:0:1: E902")
assert err == ""
+
+
+def test_output_file(tmpdir, capsys):
+ """Ensure that --output-file is honored."""
+ tmpdir.join('t.py').write('import os\n')
+
+ with tmpdir.as_cwd():
+ _call_main(['t.py', '--output-file=f'], retv=1)
+
+ out, err = capsys.readouterr()
+ assert out == err == ""
+
+ expected = "t.py:1:1: F401 'os' imported but unused\n"
+ assert tmpdir.join('f').read() == expected