module documentation

Tests for Sphinx integration.
Class ​Closing​Bytes​IO A io.BytesIO instance that closes itself after all its data has been read. This mimics the behavior of http.client.HTTPResponse in the standard library.
Class ​Inv​Reader Undocumented
Class ​Inv​Writer Undocumented
Class ​Pydoctor​Logger Partial implementation of pydoctor.model.System.msg() that records logged messages.
Class ​Pydoctor​No​Logger Partial implementation of pydoctor.model.System.msg() that asserts if any message is logged.
Class ​Test​Intersphinx​Cache Tests for sphinx.IntersphinxCache
Class ​Test​Parse​Max​Age Tests for sphinx.parseMaxAge
Class ​Unknown​Type Documentable type to help with testing.
Function cache​Directory Undocumented
Function get​_inv​_writer​_with​_logger
Function inv​_reader Undocumented
Function inv​_reader​_nolog Undocumented
Function inv​_writer​_nolog
Function test_​Closing​Bytes​IO ClosingBytesIO closes itself when all its data has been read.
Function test​_generate​_empty​_functional Functional test for index generation of empty API.
Function test_generate​Content Return a string with inventory for all targeted objects, recursive.
Function test_generate​Line_attribute Check inventory for attributes.
Function test_generate​Line_class Check inventory for class.
Function test_generate​Line_function Check inventory for function.
Function test_generate​Line_method Check inventory for method.
Function test_generate​Line_module Check inventory for module.
Function test_generate​Line_package Check inventory for package.
Function test_generate​Line_unknown When object type is uknown a message is logged and is handled as generic object.
Function test_get​Link_found Return the link from internal state.
Function test_get​Link_not_found Return None if link does not exists.
Function test_get​Link_self_anchor Return the link with anchor as target name when link end with $.
Function test_get​Payload_content Return content as string.
Function test_get​Payload_empty Return empty string.
Function test_get​Payload_invalid_decode Return empty string and log an error when failing to uncompress data.
Function test_get​Payload_invalid_uncompress Return empty string and log an error when failing to uncompress data.
Function test_parse​Inventory_empty Return empty dict for empty input.
Function test_parse​Inventory_invalid_lines Skip line and log an error.
Function test_parse​Inventory_single_line Return a dict with a single member.
Function test_parse​Inventory_spaces Sphinx inventory lines always contain 5 values, separated by spaces. However, the first and fifth value can contain internal spaces. The parser must be able to tell apart separators from internal spaces.
Function test_parse​Inventory_type_filter Ignore entries that don't have a 'py:' type field.
Function test_prepare​Cache The cache directory is deleted when clearCache is True; an IntersphinxCache is created with a session on which is mounted cachecontrol.CacheControlAdapter for http and https URLs.
Function test​_update​_bad​_url Log an error when failing to get base url from url.
Function test​_update​_fail Log an error when failing to get content from url.
Function test​_update​_functional Functional test for updating from an empty inventory.
Constant IGNORE​_SYSTEM Passed as a System when we don't want the system to be accessed.
Variable max​Age​Amounts Undocumented
Variable max​Age​Units Undocumented
@pytest.fixture(scope='module')
def cacheDirectory(request, tmp_path_factory):

Undocumented

Parameters
request:FixtureRequestUndocumented
tmp​_path​_factory:TempPathFactoryUndocumented
Returns
PathUndocumented
def get_inv_writer_with_logger(name='project_name', version='1.2'):
Parameters
name:strUndocumented
version:strUndocumented
Returns
Tuple[InvWriter, PydoctorLogger]Tuple of a Sphinx inventory writer connected to the logger.
@pytest.fixture
def inv_reader():

Undocumented

Returns
InvReaderUndocumented
@pytest.fixture
def inv_reader_nolog():

Undocumented

Returns
sphinx.SphinxInventoryUndocumented
@pytest.fixture
def inv_writer_nolog():
Returns
sphinx.SphinxInventoryWriterA Sphinx inventory writer that is connected to a null logger.
def test_ClosingBytesIO():
ClosingBytesIO closes itself when all its data has been read.
def test_generate_empty_functional():

Functional test for index generation of empty API.

Header is plain text while content is compressed.

def test_generateContent(inv_writer_nolog):
Return a string with inventory for all targeted objects, recursive.
Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_attribute(inv_writer_nolog):
Check inventory for attributes.
Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_class(inv_writer_nolog):
Check inventory for class.
Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_function(inv_writer_nolog):

Check inventory for function.

Functions are inside a module.

Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_method(inv_writer_nolog):

Check inventory for method.

Methods are functions inside a class.

Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_module(inv_writer_nolog):
Check inventory for module.
Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_package(inv_writer_nolog):
Check inventory for package.
Parameters
inv​_writer​_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_unknown():
When object type is uknown a message is logged and is handled as generic object.
def test_getLink_found(inv_reader_nolog):
Return the link from internal state.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_getLink_not_found(inv_reader_nolog):
Return None if link does not exists.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_getLink_self_anchor(inv_reader_nolog):
Return the link with anchor as target name when link end with $.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_getPayload_content(inv_reader_nolog):
Return content as string.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_getPayload_empty(inv_reader_nolog):
Return empty string.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_getPayload_invalid_decode(inv_reader):
Return empty string and log an error when failing to uncompress data.
Parameters
inv​_reader:InvReaderUndocumented
def test_getPayload_invalid_uncompress(inv_reader):
Return empty string and log an error when failing to uncompress data.
Parameters
inv​_reader:InvReaderUndocumented
def test_parseInventory_empty(inv_reader_nolog):
Return empty dict for empty input.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_parseInventory_invalid_lines(inv_reader):
Skip line and log an error.
Parameters
inv​_reader:InvReaderUndocumented
def test_parseInventory_single_line(inv_reader_nolog):
Return a dict with a single member.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
def test_parseInventory_spaces():
Sphinx inventory lines always contain 5 values, separated by spaces. However, the first and fifth value can contain internal spaces. The parser must be able to tell apart separators from internal spaces.
def test_parseInventory_type_filter(inv_reader):
Ignore entries that don't have a 'py:' type field.
Parameters
inv​_reader:InvReaderUndocumented
@given(clearCache=st.booleans(), enableCache=st.booleans(), cacheDirectoryName=st.text(alphabet=sorted(set(string.printable)-set('\\/:*?"<>|\f\v\t\r\n')), min_size=1, max_size=32), maxAgeAmount=maxAgeAmounts, maxAgeUnit=maxAgeUnits)
@settings(max_examples=700, deadline=None)
def test_prepareCache(cacheDirectory, clearCache, enableCache, cacheDirectoryName, maxAgeAmount, maxAgeUnit):
The cache directory is deleted when clearCache is True; an IntersphinxCache is created with a session on which is mounted cachecontrol.CacheControlAdapter for http and https URLs.
Parameters
cache​Directory:PathUndocumented
clear​Cache:boolUndocumented
enable​Cache:boolUndocumented
cache​Directory​Name:strUndocumented
max​Age​Amount:intUndocumented
max​Age​Unit:strUndocumented
def test_update_bad_url(inv_reader):
Log an error when failing to get base url from url.
Parameters
inv​_reader:InvReaderUndocumented
def test_update_fail(inv_reader):
Log an error when failing to get content from url.
Parameters
inv​_reader:InvReaderUndocumented
def test_update_functional(inv_reader_nolog):
Functional test for updating from an empty inventory.
Parameters
inv​_reader​_nolog:sphinx.SphinxInventoryUndocumented
IGNORE_SYSTEM =
Passed as a System when we don't want the system to be accessed.
Value
cast(model.System, 'ignore-system')
maxAgeAmounts =

Undocumented

maxAgeUnits =

Undocumented