summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-10-02 23:40:04 +0000
committerAnthony Sottile <asottile@umich.edu>2020-10-02 23:40:04 +0000
commit0efbb5dbcb481c020c92066c550961e21178d0d3 (patch)
treeb773e3de91123051ff78cb1d54484bd1794d8257 /tests/integration
parentfb91b994ed4adf4f2b4890e7bdba82f57e3a81df (diff)
parentb40af6737ed5feb7d519dc2d0277d8664a802067 (diff)
downloadflake8-0efbb5dbcb481c020c92066c550961e21178d0d3.tar.gz
Merge branch 'no_show_source' into 'master'
Add option to disable show-source for calling tools See merge request pycqa/flake8!441
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_main.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py
index 69cb12b..85afa20 100644
--- a/tests/integration/test_main.py
+++ b/tests/integration/test_main.py
@@ -108,6 +108,31 @@ t.py:2:1: F401 'sys' imported but unused
assert err == ''
+def test_show_source_option(tmpdir, capsys):
+ """Ensure that --show-source and --no-show-source work."""
+ with tmpdir.as_cwd():
+ tmpdir.join('tox.ini').write('[flake8]\nshow_source = true\n')
+ tmpdir.join('t.py').write('import os\n')
+ _call_main(['t.py'], retv=1)
+
+ out, err = capsys.readouterr()
+ assert out == '''\
+t.py:1:1: F401 'os' imported but unused
+import os
+^
+'''
+ assert err == ''
+
+ with tmpdir.as_cwd():
+ _call_main(['t.py', '--no-show-source'], retv=1)
+
+ out, err = capsys.readouterr()
+ assert out == '''\
+t.py:1:1: F401 'os' imported but unused
+'''
+ assert err == ''
+
+
def test_extend_exclude(tmpdir, capsys):
"""Ensure that `flake8 --extend-exclude` works."""
for d in ['project', 'vendor', 'legacy', '.git', '.tox', '.hg']: