Updating docs for v1.0.0b2
- Full cleanup of all the docs - General sphinx housekeeping - Updated all the old/bad links - More reliable tests - Updated Changelog - Removed dead/deprecated code - Added documentation generation test
This commit is contained in:
@@ -18,17 +18,28 @@ def cleanup():
|
||||
p.kill()
|
||||
|
||||
|
||||
def run_subprocesses(address, server, client):
|
||||
def run_subprocesses(address, server, client, wildcard_server=False, ipv4_force=True):
|
||||
server_attempt = 0
|
||||
server_attempts = 2
|
||||
done = False
|
||||
addr, port = address.split(':')
|
||||
c_address = address
|
||||
s_address = address
|
||||
while not done:
|
||||
assert server_attempt < server_attempts, "Failed {} server attempts".format(server_attempts)
|
||||
server_attempt += 1
|
||||
|
||||
# Force ipv4 for tests (known issues on GitHub Actions with IPv6 for some targets)
|
||||
if 'unix' not in addr and ipv4_force:
|
||||
addr = socket.gethostbyname(addr)
|
||||
c_address = '{}:{}'.format(addr, port)
|
||||
s_address = c_address
|
||||
if wildcard_server:
|
||||
s_address = '*:{}'.format(port) # Use wildcard address for server
|
||||
print("Forcing ipv4 -> {} => {} {}".format(address, c_address, s_address))
|
||||
|
||||
# Start server
|
||||
cmd = [sys.executable, os.path.join(examples_dir, server), address]
|
||||
cmd = [sys.executable, os.path.join(examples_dir, server), s_address]
|
||||
serverp = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
|
||||
print("Server started (Attempt #{})".format(server_attempt))
|
||||
processes.append(serverp)
|
||||
@@ -74,7 +85,7 @@ def run_subprocesses(address, server, client):
|
||||
client_attempt += 1
|
||||
|
||||
# Start client
|
||||
cmd = [sys.executable, os.path.join(examples_dir, client), address]
|
||||
cmd = [sys.executable, os.path.join(examples_dir, client), c_address]
|
||||
clientp = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
|
||||
print("Client started (Attempt #{})".format(client_attempt))
|
||||
processes.append(clientp)
|
||||
@@ -96,11 +107,6 @@ def run_subprocesses(address, server, client):
|
||||
clientp.kill()
|
||||
break
|
||||
|
||||
# Retrying with different address (ipv4)
|
||||
if 'unix' not in addr:
|
||||
addr = socket.gethostbyname(addr)
|
||||
address = '{}:{}'.format(addr, port)
|
||||
print("Forcing ipv4 -> {}".format(address))
|
||||
serverp.kill()
|
||||
|
||||
serverp.kill()
|
||||
@@ -117,7 +123,7 @@ def test_thread_example(cleanup):
|
||||
address = '{}:36433'.format(hostname)
|
||||
server = 'thread_server.py'
|
||||
client = 'thread_client.py'
|
||||
run_subprocesses(address, server, client)
|
||||
run_subprocesses(address, server, client, wildcard_server=True)
|
||||
|
||||
|
||||
def test_addressbook_example(cleanup):
|
||||
@@ -139,7 +145,7 @@ def test_ssl_async_example(cleanup):
|
||||
address = '{}:36435'.format(hostname)
|
||||
server = 'async_ssl_server.py'
|
||||
client = 'async_ssl_client.py'
|
||||
run_subprocesses(address, server, client)
|
||||
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")
|
||||
@@ -147,11 +153,11 @@ def test_ssl_reconnecting_async_example(cleanup):
|
||||
address = '{}:36436'.format(hostname)
|
||||
server = 'async_ssl_server.py'
|
||||
client = 'async_reconnecting_ssl_client.py'
|
||||
run_subprocesses(address, server, client)
|
||||
run_subprocesses(address, server, client, ipv4_force=False)
|
||||
|
||||
|
||||
def test_async_ssl_calculator_example(cleanup):
|
||||
address = '{}:36437'.format(hostname)
|
||||
server = 'async_ssl_calculator_server.py'
|
||||
client = 'async_ssl_calculator_client.py'
|
||||
run_subprocesses(address, server, client)
|
||||
run_subprocesses(address, server, client, ipv4_force=False)
|
||||
|
||||
@@ -28,7 +28,7 @@ def test_object_basic(addressbook):
|
||||
|
||||
def test_object_list(addressbook):
|
||||
obj = capnp._MallocMessageBuilder().get_root_as_any()
|
||||
listSchema = capnp.ListSchema(addressbook.Person)
|
||||
listSchema = capnp._ListSchema(addressbook.Person)
|
||||
people = obj.init_as_list(listSchema, 2)
|
||||
person = people[0]
|
||||
person.name = 'test'
|
||||
|
||||
@@ -35,7 +35,7 @@ def test_calculator():
|
||||
|
||||
def test_calculator_tcp(cleanup):
|
||||
address = 'localhost:36431'
|
||||
test_examples.run_subprocesses(address, 'calculator_server.py', 'calculator_client.py')
|
||||
test_examples.run_subprocesses(address, 'calculator_server.py', 'calculator_client.py', wildcard_server=True)
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == 'nt', reason="socket.AF_UNIX not supported on Windows")
|
||||
|
||||
@@ -25,7 +25,7 @@ def test_list_schema(addressbook):
|
||||
|
||||
assert personType.node.id == addressbook.Person.schema.node.id
|
||||
|
||||
personListSchema = capnp.ListSchema(addressbook.Person)
|
||||
personListSchema = capnp._ListSchema(addressbook.Person)
|
||||
|
||||
assert personListSchema.elementType.node.id == addressbook.Person.schema.node.id
|
||||
|
||||
@@ -40,11 +40,11 @@ def test_annotations(annotations):
|
||||
assert annotation.value.struct.as_struct(annotations.AnnotationStruct).test == 100
|
||||
|
||||
annotation = annotations.TestAnnotationThree.schema.node.annotations[0]
|
||||
annotation_list = annotation.value.list.as_list(capnp.ListSchema(annotations.AnnotationStruct))
|
||||
annotation_list = annotation.value.list.as_list(capnp._ListSchema(annotations.AnnotationStruct))
|
||||
assert annotation_list[0].test == 100
|
||||
assert annotation_list[1].test == 101
|
||||
|
||||
annotation = annotations.TestAnnotationFour.schema.node.annotations[0]
|
||||
annotation_list = annotation.value.list.as_list(capnp.ListSchema(capnp.types.UInt16))
|
||||
annotation_list = annotation.value.list.as_list(capnp._ListSchema(capnp.types.UInt16))
|
||||
assert annotation_list[0] == 200
|
||||
assert annotation_list[1] == 201
|
||||
|
||||
@@ -181,20 +181,6 @@ def test_roundtrip_bytes_multiple_packed(all_types):
|
||||
assert i == 3
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.python_implementation() == 'PyPy',
|
||||
reason="This works on my local PyPy v2.5.0, but is for some reason broken on TravisCI. Skip for now."
|
||||
)
|
||||
def test_roundtrip_dict(all_types):
|
||||
msg = all_types.TestAllTypes.new_message()
|
||||
test_regression.init_all_types(msg)
|
||||
d = msg.to_dict()
|
||||
|
||||
with _warnings(1, expected_text="This method is deprecated and will be removed"):
|
||||
msg = all_types.TestAllTypes.from_dict(d)
|
||||
test_regression.check_all_types(msg)
|
||||
|
||||
|
||||
def test_file_and_bytes(all_types):
|
||||
f = tempfile.TemporaryFile()
|
||||
msg = all_types.TestAllTypes.new_message()
|
||||
|
||||
Reference in New Issue
Block a user