11# -*- coding: utf-8 -*-
2- """Pins the hand-written cross-references that could never resolve (#1919, #1920).
2+ """Pins the hand-written cross-references that cannot resolve (#1919, #1920).
33
44Sphinx builds without ``nitpicky``, so a role whose target exists in no inventory
55and on no page renders as an unlinked chip and warns about nothing. #934 part C
1010* :class:`InventorylessPackageRoleTests` -- ``aenum``, ``pyshark``, ``pcap``
1111 (PyPCAP and pcap-ct), ``pcapfile`` (PyPCAPFile) and ``emoji`` publish no
1212 ``objects.inv`` with ``py:`` objects in it, so no role naming them can resolve.
13- ``AenumRoleExclusionTests`` in :file:`test_conventions_doc_claims.py` enforced
14- that for the conventions pages only ; this widens it to every hand-written
15- source under :file:`docs/` and :file:`pcapkit/`.
16- * :class:`DeadTargetTests` -- the targets #1919 found that *are* in a package with
17- an inventory, but not in that inventory: the role, the path, or the name was
18- wrong . Each is pinned in the form it used to take .
19- * :class:`DocumentedEntryTests` -- the names #1919 decided are contract, and so
20- gained an entry rather than losing the role.
13+ ``AenumRoleExclusionTests`` in :file:`test_conventions_doc_claims.py` checks
14+ the conventions pages; this class checks every hand-written source under
15+ :file:`docs/` and :file:`pcapkit/`.
16+ * :class:`DeadTargetTests` -- targets in a package that has an inventory, but
17+ absent from that inventory because the role, the path or the name is wrong
18+ (#1919) . Each is pinned in the form that fails to resolve .
19+ * :class:`DocumentedEntryTests` -- the names #1919 decided are contract, which
20+ have an entry rather than a demoted role.
2121
2222Scoped to hand-written sources. :file:`docs/source/conf.py` is excluded because
2323its aenum formatter emits roles at build time (#1858) and is the generated half
24- of #1920. ``pcapkit/vendor /`` and ``pcapkit/const/`` are excluded too: the
25- templates are regenerated into the constant modules, and both are handled
26- separately from this change .
24+ of #1920. ``pcapkit/const /`` and the vendor templates that generate it are
25+ excluded too, and are handled separately; the rest of ``pcapkit/vendor/`` is
26+ scanned .
2727
2828"""
2929
3939#: docstring for why each is out of scope.
4040EXCLUDED = (
4141 'docs/source/conf.py' ,
42- 'pcapkit/vendor/' ,
42+ 'pcapkit/vendor/pcapng/option_type.py' ,
43+ 'pcapkit/vendor/reg/apptype/apptype.py' ,
4344 'pcapkit/const/' ,
4445)
4546
@@ -97,7 +98,8 @@ def test_the_scan_reads_the_pages_and_modules_it_claims_to(self) -> 'None':
9798 'docs/source/pcapkit/toolkit/3rdparty.rst' ,
9899 'pcapkit/corekit/fields/numbers.py' ,
99100 'pcapkit/corekit/enum.py' ,
100- 'pcapkit/foundation/engines/pypcap.py' ):
101+ 'pcapkit/foundation/engines/pypcap.py' ,
102+ 'pcapkit/vendor/default.py' ):
101103 self .assertIn (expected , names )
102104 for excluded in EXCLUDED :
103105 self .assertFalse (any (name == excluded or name .startswith (excluded )
@@ -114,7 +116,7 @@ def test_no_role_names_an_inventoryless_package(self) -> 'None':
114116
115117 Matched on the target's first dotted component, so ``pcapkit`` and
116118 ``pcapng`` are not mistaken for ``pcap``. The plain double-backtick
117- literal stays allowed: it is what #934 part C converts these roles to .
119+ literal is allowed: it is the form #934 part C prescribes for these roles.
118120
119121 """
120122 offenders = [f'{ path } :{ line } : :{ role } :`{ target } `'
@@ -162,12 +164,14 @@ class DeadTargetTests(unittest.TestCase):
162164 'the pcapng schema field has no entry; write it as a literal' ),
163165 (None , 'pcapkit.protocols.schema.misc.pcapng.OptionEnumField.post_process' ,
164166 'the pcapng schema field has no entry; write it as a literal' ),
167+ (None , 'pcapkit.vendor.__main__.run' ,
168+ 'the CLI module documents no functions; write it as a literal' ),
165169 (None , 'EnumMeta.registry' ,
166170 'unqualified, it does not resolve from the pages that cite it; qualify it' ),
167171 )
168172
169- def test_no_dead_target_comes_back (self ) -> 'None' :
170- """Each pairing #1919 retargeted or demoted stays gone ."""
173+ def test_no_dead_target_appears (self ) -> 'None' :
174+ """No retargeted or demoted pairing from #1919 appears ."""
171175 roles = _roles ()
172176 offenders = []
173177 for want_role , want_target , why in self .DEAD :
@@ -178,7 +182,7 @@ def test_no_dead_target_comes_back(self) -> 'None':
178182
179183
180184class DocumentedEntryTests (unittest .TestCase ):
181- """The names #1919 found cited as contract gained an entry of their own."""
185+ """The names cited as contract (#1919) have an entry of their own."""
182186
183187 def test_compat_final_has_an_entry_under_its_module (self ) -> 'None' :
184188 """``pcapkit.utilities.compat.final`` is what ``@info_final`` tells callers to use.
0 commit comments