Skip to content
GitLab
探索
项目
群组
代码片段
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录
切换导航
菜单
打开侧边栏
ExternalRepo
flake8
提交
915184a1
提交
915184a1
编辑于
6年前
作者:
Anthony Sottile
浏览文件
操作
下载
电子邮件补丁
差异文件
Add integration test for `flake8 --diff`
上级
763f68b6
main
pre-commit-ci-update-config
remove-statistics-count-benchmarks
7.0.0
6.1.0
6.0.0
5.0.4
5.0.3
5.0.2
5.0.1
5.0.0
4.0.1
4.0.0
3.9.2
3.9.1
3.9.0
3.8.4
3.8.3
3.8.2
3.8.1
3.8.0
3.8.0a2
3.8.0a1
3.7.9
3.7.8
3.7.7
3.7.6
3.7.5
3.7.4
3.7.3
3.7.2
无相关合并请求
变更
1
Hide whitespace changes
Inline
Side-by-side
显示
1 个更改的文件
tests/integration/test_main.py
+43
-0
tests/integration/test_main.py
有
43 个添加
和
0 个删除
+43
-0
tests/integration/test_main.py
0 → 100644
+
43
-
0
浏览文件 @
915184a1
"""Integration tests for the main entrypoint of flake8."""
import
mock
from
flake8
import
utils
from
flake8.main
import
application
def
test_diff_option
(
tmpdir
,
capsys
):
"""Ensure that FileChecker can handle --diff."""
t_py_contents
=
'''
\
import os
import sys # unused but not part of diff
print('(to avoid trailing whitespace in test)')
print('(to avoid trailing whitespace in test)')
print(os.path.join('foo', 'bar'))
y # part of the diff and an error
'''
diff
=
'''
\
diff --git a/t.py b/t.py
index d64ac39..7d943de 100644
--- a/t.py
+++ b/t.py
@@ -4,3 +4,5 @@ import sys # unused but not part of diff
print('(to avoid trailing whitespace in test)')
print('(to avoid trailing whitespace in test)')
print(os.path.join('foo', 'bar'))
+
+y # part of the diff and an error
'''
with
mock
.
patch
.
object
(
utils
,
'stdin_get_value'
,
return_value
=
diff
):
with
tmpdir
.
as_cwd
():
tmpdir
.
join
(
't.py'
).
write
(
t_py_contents
)
app
=
application
.
Application
()
app
.
run
([
'--diff'
])
out
,
err
=
capsys
.
readouterr
()
assert
out
==
"t.py:8:1: F821 undefined name 'y'
\n
"
assert
err
==
''
This diff is collapsed.
Click to expand it.
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
菜单
探索
项目
群组
代码片段