Skip to content

Commit e0897af

Browse files
committed
docs: state the #1919 test's checks without timed context (#1919)
- Restate the test's docstrings as what each check asserts, and rename test_no_dead_target_comes_back to test_no_dead_target_appears. - Demote the pcapkit.vendor.__main__.run cite in vendor/default.py to a literal beside the documented module; the CLI module documents no functions. - Scan pcapkit/vendor/ apart from the two templates still carrying aenum roles, and pin pcapkit.vendor.__main__.run as a dead target. Closes #1919 Refs #1920
1 parent a5e5cc8 commit e0897af

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

‎pcapkit/vendor/default.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ def _dest_path(cls) -> 'str':
583583
to obtain it. That lets a caller resolve a crawler's destination
584584
*without* instantiating it, and so without triggering
585585
:meth:`Vendor.__init__`'s network fetch, render and write --
586-
:func:`pcapkit.vendor.__main__.run`'s pre-run snapshot (GitHub issue
587-
:issue:`872`) is exactly such a caller. Every crawler defined in this
586+
the pre-run snapshot that ``run()`` in :mod:`pcapkit.vendor.__main__`
587+
takes (GitHub issue :issue:`872`) is exactly such a caller. Every crawler defined in this
588588
codebase inherits this implementation unchanged; none overrides
589589
``_dest_path``, so the classmethod is authoritative for all of them.
590590

‎tests/project/test_docs_unresolvable_roles_1919_unit.py‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
44
Sphinx builds without ``nitpicky``, so a role whose target exists in no inventory
55
and on no page renders as an unlinked chip and warns about nothing. #934 part C
@@ -10,20 +10,20 @@
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
2222
Scoped to hand-written sources. :file:`docs/source/conf.py` is excluded because
2323
its 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

@@ -39,7 +39,8 @@
3939
#: docstring for why each is out of scope.
4040
EXCLUDED = (
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

180184
class 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

Comments
 (0)