Skip to content

Commit ba801c7

Browse files
authored
qa: run flake8 for test/ (#409)
1 parent 932af95 commit ba801c7

File tree

8 files changed

+22
-8
lines changed

8 files changed

+22
-8
lines changed

setup.cfg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
test = pytest
33

44
[flake8]
5-
ignore = D211,E731,D401,W503
5+
extend-ignore = D211,E731,D401,W503
66
max-line-length = 88
7+
per-file-ignores =
8+
test/*:D1
9+
10+
[isort]
11+
known_first_party = pynvim
712

813
[tool:pytest]
914
testpaths = test

test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import textwrap
44

55
import pynvim
6+
67
import pytest
78

89
pynvim.setup_logging("test")

test/test_buffer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,24 @@ def test_get_exceptions(vim):
160160
except vim.error:
161161
pass
162162

163+
163164
def test_set_items_for_range(vim):
164165
vim.current.buffer[:] = ['a', 'b', 'c', 'd', 'e']
165166
r = vim.current.buffer.range(1, 3)
166-
r[1:3] = ['foo']*3
167+
r[1:3] = ['foo'] * 3
167168
assert vim.current.buffer[:] == ['a', 'foo', 'foo', 'foo', 'd', 'e']
168169

170+
169171
# NB: we can't easily test the effect of this. But at least run the lua
170172
# function sync, so we know it runs without runtime error with simple args.
171173
def test_update_highlights(vim):
172174
vim.current.buffer[:] = ['a', 'b', 'c']
173175
src_id = vim.new_highlight_source()
174-
vim.current.buffer.update_highlights(src_id, [["Comment", 0, 0, -1], ("String", 1, 0, 1)], clear=True, async_=False)
176+
vim.current.buffer.update_highlights(
177+
src_id, [["Comment", 0, 0, -1], ("String", 1, 0, 1)], clear=True, async_=False
178+
)
175179

176180

177181
def test_buffer_inequality(vim):
178182
b = vim.current.buffer
179183
assert not (b != vim.current.buffer)
180-

test/test_client_rpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
def test_call_and_reply(vim):
66
cid = vim.channel_id
7+
78
def setup_cb():
89
cmd = 'let g:result = rpcrequest(%d, "client-call", 1, 2, 3)' % cid
910
vim.command(cmd)
@@ -20,6 +21,7 @@ def request_cb(name, args):
2021

2122
def test_call_api_before_reply(vim):
2223
cid = vim.channel_id
24+
2325
def setup_cb():
2426
cmd = 'let g:result = rpcrequest(%d, "client-call2", 1, 2, 3)' % cid
2527
vim.command(cmd)
@@ -32,6 +34,7 @@ def request_cb(name, args):
3234

3335
vim.run_loop(request_cb, None, setup_cb)
3436

37+
3538
def test_async_call(vim):
3639

3740
def request_cb(name, args):
@@ -52,6 +55,7 @@ def request_cb(name, args):
5255

5356
def test_recursion(vim):
5457
cid = vim.channel_id
58+
5559
def setup_cb():
5660
vim.vars['result1'] = 0
5761
vim.vars['result2'] = 0

test/test_concurrency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
def test_interrupt_from_another_thread(vim):
55
timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
66
timer.start()
7-
assert vim.next_message() == None
7+
assert vim.next_message() is None
88

99

1010
def test_exception_in_threadsafe_call(vim):
1111
# an exception in a threadsafe_call shouldn't crash the entire host
1212
msgs = []
13-
vim.async_call(lambda: [vim.eval("3"), undefined_variable])
13+
vim.async_call(lambda: [vim.eval("3"), undefined_variable]) # noqa: F821
1414
timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
1515
timer.start()
1616
vim.run_loop(None, None, err_cb=msgs.append)

test/test_decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def test_command_count():
55
def function():
6-
"A dummy function to decorate."
6+
"""A dummy function to decorate."""
77
return
88

99
# ensure absence with default value of None

test/test_host.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pynvim.plugin.host import Host, host_method_spec
44

5+
56
def test_host_clientinfo(vim):
67
h = Host(vim)
78
assert h._request_handlers.keys() == host_method_spec.keys()

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ deps =
1818
flake8-import-order
1919
flake8-docstrings
2020
pep8-naming
21-
commands = flake8 {posargs:pynvim}
21+
commands = flake8 {posargs:pynvim test}
2222

2323
[testenv:docs]
2424
deps =

0 commit comments

Comments
 (0)