module documentation

Tests for Sphinx integration.

Class ClosingBytesIO 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 IgnoreSystem Undocumented
Class InvReader Undocumented
Class InvWriter Undocumented
Class PydoctorLogger Partial implementation of pydoctor.model.System.msg() that records logged messages.
Class PydoctorNoLogger Partial implementation of pydoctor.model.System.msg() that asserts if any message is logged.
Class TestIntersphinxCache Tests for sphinx.IntersphinxCache
Class TestParseMaxAge Tests for sphinx.parseMaxAge
Class UnknownType Documentable type to help with testing.
Function cacheDirectory Undocumented
Function get_inv_writer_with_logger No summary
Function inv_reader Undocumented
Function inv_reader_nolog Undocumented
Function inv_writer_nolog No summary
Function test_ClosingBytesIO 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_generateContent Return a string with inventory for all targeted objects, recursive.
Function test_generateLine_attribute Check inventory for attributes.
Function test_generateLine_class Check inventory for class.
Function test_generateLine_function Check inventory for function.
Function test_generateLine_method Check inventory for method.
Function test_generateLine_module Check inventory for module.
Function test_generateLine_package Check inventory for package.
Function test_generateLine_unknown When object type is uknown a message is logged and is handled as generic object.
Function test_getLink_found Return the link from internal state.
Function test_getLink_not_found Return None if link does not exists.
Function test_getLink_self_anchor Return the link with anchor as target name when link end with $.
Function test_getPayload_content Return content as string.
Function test_getPayload_empty Return empty string.
Function test_getPayload_invalid_decode Return empty string and log an error when failing to uncompress data.
Function test_getPayload_invalid_uncompress Return empty string and log an error when failing to uncompress data.
Function test_parseInventory_empty Return empty dict for empty input.
Function test_parseInventory_invalid_lines Skip line and log an error.
Function test_parseInventory_single_line Return a dict with a single member.
Function 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.
Function test_parseInventory_type_filter Ignore entries that don't have a 'py:' type field.
Function test_prepareCache 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 maxAgeAmounts Undocumented
Variable maxAgeUnits Undocumented
@pytest.fixture(scope='module')
def cacheDirectory(request, tmp_path_factory): (source)

Undocumented

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

Undocumented

Returns
InvReaderUndocumented
@pytest.fixture
def inv_reader_nolog(): (source)

Undocumented

Returns
sphinx.SphinxInventoryUndocumented
@pytest.fixture
def inv_writer_nolog(): (source)
Returns
sphinx.SphinxInventoryWriterA Sphinx inventory writer that is connected to a null logger.
def test_ClosingBytesIO(): (source)

ClosingBytesIO closes itself when all its data has been read.

def test_generate_empty_functional(): (source)

Functional test for index generation of empty API.

Header is plain text while content is compressed.

def test_generateContent(inv_writer_nolog): (source)

Return a string with inventory for all targeted objects, recursive.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_attribute(inv_writer_nolog): (source)

Check inventory for attributes.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_class(inv_writer_nolog): (source)

Check inventory for class.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_function(inv_writer_nolog): (source)

Check inventory for function.

Functions are inside a module.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_method(inv_writer_nolog): (source)

Check inventory for method.

Methods are functions inside a class.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_module(inv_writer_nolog): (source)

Check inventory for module.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_package(inv_writer_nolog): (source)

Check inventory for package.

Parameters
inv_writer_nolog:sphinx.SphinxInventoryWriterUndocumented
def test_generateLine_unknown(): (source)

When object type is uknown a message is logged and is handled as generic object.

def test_getLink_found(inv_reader_nolog): (source)

Return the link from internal state.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_getLink_not_found(inv_reader_nolog): (source)

Return None if link does not exists.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_getLink_self_anchor(inv_reader_nolog): (source)

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): (source)

Return content as string.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_getPayload_empty(inv_reader_nolog): (source)

Return empty string.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_getPayload_invalid_decode(inv_reader): (source)

Return empty string and log an error when failing to uncompress data.

Parameters
inv_reader:InvReaderUndocumented
def test_getPayload_invalid_uncompress(inv_reader): (source)

Return empty string and log an error when failing to uncompress data.

Parameters
inv_reader:InvReaderUndocumented
def test_parseInventory_empty(inv_reader_nolog): (source)

Return empty dict for empty input.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_parseInventory_invalid_lines(inv_reader): (source)

Skip line and log an error.

Parameters
inv_reader:InvReaderUndocumented
def test_parseInventory_single_line(inv_reader_nolog): (source)

Return a dict with a single member.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
def test_parseInventory_spaces(): (source)

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): (source)

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): (source)

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
cacheDirectory:PathUndocumented
clearCache:boolUndocumented
enableCache:boolUndocumented
cacheDirectoryName:strUndocumented
maxAgeAmount:intUndocumented
maxAgeUnit:strUndocumented
def test_update_bad_url(inv_reader): (source)

Log an error when failing to get base url from url.

Parameters
inv_reader:InvReaderUndocumented
def test_update_fail(inv_reader): (source)

Log an error when failing to get content from url.

Parameters
inv_reader:InvReaderUndocumented
def test_update_functional(inv_reader_nolog): (source)

Functional test for updating from an empty inventory.

Parameters
inv_reader_nolog:sphinx.SphinxInventoryUndocumented
IGNORE_SYSTEM = (source)

Passed as a System when we don't want the system to be accessed.

Value
cast(model.System, IgnoreSystem())
maxAgeAmounts = (source)

Undocumented

maxAgeUnits = (source)

Undocumented