Fixing flake8 linting errors

- Enabling builds to fail on simple lint failures now
This commit is contained in:
Jacob Alexander
2020-11-20 23:38:13 -08:00
parent 2e6d7be1dd
commit a4ef16e831
14 changed files with 35 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ hostname = 'localhost'
processes = []
@pytest.fixture
def cleanup():
yield
@@ -18,7 +19,7 @@ def cleanup():
p.kill()
def run_subprocesses(address, server, client, wildcard_server=False, ipv4_force=True):
def run_subprocesses(address, server, client, wildcard_server=False, ipv4_force=True): # noqa
server_attempt = 0
server_attempts = 2
done = False
@@ -35,7 +36,7 @@ def run_subprocesses(address, server, client, wildcard_server=False, ipv4_force=
c_address = '{}:{}'.format(addr, port)
s_address = c_address
if wildcard_server:
s_address = '*:{}'.format(port) # Use wildcard address for server
s_address = '*:{}'.format(port) # Use wildcard address for server
print("Forcing ipv4 -> {} => {} {}".format(address, c_address, s_address))
# Start server
@@ -133,7 +134,13 @@ def test_addressbook_example(cleanup):
assert ret == 0
@pytest.mark.skipif(sys.platform == "win32", reason="Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop. See https://github.com/capnproto/pycapnp/issues/196")
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
"""
)
def test_async_example(cleanup):
address = '{}:36434'.format(hostname)
server = 'async_server.py'
@@ -141,7 +148,13 @@ def test_async_example(cleanup):
run_subprocesses(address, server, client)
@pytest.mark.skipif(sys.platform == "win32", reason="Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop. See https://github.com/capnproto/pycapnp/issues/196")
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
"""
)
def test_ssl_async_example(cleanup):
address = '{}:36435'.format(hostname)
server = 'async_ssl_server.py'
@@ -149,7 +162,13 @@ def test_ssl_async_example(cleanup):
run_subprocesses(address, server, client, ipv4_force=False)
@pytest.mark.skipif(sys.platform == "win32", reason="Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop. See https://github.com/capnproto/pycapnp/issues/196")
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
"""
)
def test_ssl_reconnecting_async_example(cleanup):
address = '{}:36436'.format(hostname)
server = 'async_ssl_server.py'

View File

@@ -116,4 +116,4 @@ def test_remove_import_hook():
def test_bundled_import_hook():
# stream.capnp should be bundled, or provided by the system capnproto
capnp.add_import_hook()
import stream_capnp
import stream_capnp # noqa: F401

View File

@@ -32,6 +32,7 @@ def test_simple_rpc_with_options():
remote = cap.foo(i=5)
_ = remote.wait()
def test_simple_rpc_bootstrap():
read, write = socket.socketpair()

View File

@@ -2,9 +2,7 @@ import gc
import os
import pytest
import socket
import subprocess
import sys # add examples dir to sys.path
import time
import capnp
@@ -15,10 +13,11 @@ import calculator_client # noqa: E402
import calculator_server # noqa: E402
# Uses run_subprocesses function
import test_examples
import test_examples # noqa: E402
processes = []
@pytest.fixture
def cleanup():
yield

View File

@@ -106,6 +106,7 @@ def test_roundtrip_bytes_packed(all_types):
msg = all_types.TestAllTypes.from_bytes_packed(message_bytes)
test_regression.check_all_types(msg)
@contextmanager
def _warnings(expected_count=2, expected_text='This message has already been written once.'):
with warnings.catch_warnings(record=True) as w:
@@ -115,6 +116,7 @@ def _warnings(expected_count=2, expected_text='This message has already been wri
assert all(issubclass(x.category, UserWarning) for x in w), w
assert all(expected_text in str(x.message) for x in w), w
def test_roundtrip_file_multiple(all_types):
f = tempfile.TemporaryFile()
msg = all_types.TestAllTypes.new_message()