Download:
child 316:c8c41a411b36
parent 314:a3c2e221cadf
315:b3c5f2cf42fb
Anton Shestakov <av6@dwimlabs.net>, Sun, 08 Oct 2017 10:01:43 +0800
tests: reorder and update tests for match_linter_output() slightly

1 файлов изменено, 16 вставок(+), 11 удалений(-) [+]
tests/test_incoming.py file | annotate | diff | comparison | revisions
--- a/tests/test_incoming.py Sun Oct 08 10:00:32 2017 +0800
+++ b/tests/test_incoming.py Sun Oct 08 10:01:43 2017 +0800
@@ -5,6 +5,7 @@
mlo = match_linter_output
usual_keys = ['cls', 'filename', 'line_number', 'link_end', 'link_start']
+ # flake8
errors, warnings, extra = mlo('hello.py:42:1: W123 clowntown ahoy')
assert errors == 0
assert warnings == 1
@@ -15,6 +16,7 @@
assert extra['link_start'] == 0
assert extra['link_end'] == 11
+ # yamllint
errors, warnings, extra = mlo('s p a c e.yml:07:01: [error] oops! (uh-oh)')
assert errors == 1
assert warnings == 0
@@ -25,17 +27,8 @@
assert extra['link_start'] == 0
assert extra['link_end'] == 16
- errors, warnings, extra = mlo('requirements.txt:1:1: PIL is obsolete.')
- assert errors == 0
- assert warnings == 1
- assert sorted(extra.keys()) == usual_keys
- assert extra['cls'] == 'warning'
- assert extra['filename'] == 'requirements.txt'
- assert extra['line_number'] == 1
- assert extra['link_start'] == 0
- assert extra['link_end'] == 18
-
- errors, warnings, extra = mlo('ham.lua:414:90: (E101) foo is not good')
+ # luacheck
+ errors, warnings, extra = mlo('ham.lua:414:90: (E101) ham is stale')
assert errors == 1
assert warnings == 0
assert sorted(extra.keys()) == usual_keys
@@ -45,6 +38,7 @@
assert extra['link_start'] == 0
assert extra['link_end'] == 11
+ # jshint
errors, warnings, extra = mlo('backwards.js:9091:1: not perfect (W201)')
assert errors == 0
assert warnings == 1
@@ -55,6 +49,17 @@
assert extra['link_start'] == 0
assert extra['link_end'] == 17
+ # generic
+ errors, warnings, extra = mlo('requirements.txt:5:1: PIL is obsolete.')
+ assert errors == 0
+ assert warnings == 1
+ assert sorted(extra.keys()) == usual_keys
+ assert extra['cls'] == 'warning'
+ assert extra['filename'] == 'requirements.txt'
+ assert extra['line_number'] == 5
+ assert extra['link_start'] == 0
+ assert extra['link_end'] == 18
+
def test_parse_project_url():
result = parse_project_url('https://example.com/alice/hello-world')