livery.extensions.coverage._leg¶
livery.extensions.coverage._leg ¶
The check leg's half of coverage: each suite's parts, left for the leg's write.
A check leg's tests run measured. At the leg's end the coverage
extension's entry, coverage.leg, first runs the suites no record
can supply at their current closure, when the gate ran narrowed or
skipped (top_up). Then it gathers the parts of every suite the leg
ran (gather_leg): the parts a native suite's measurer left in the
workspace, and the parts the listed reductions make of the data the
run left, once for each suite, each holding the files of the suite's
closure. It leaves them in the line format's stored form, with the
fixed facts they name and the scope the leg measured, for the leg's
one write, which puts them on the leg's per-run ref beside its timing
row, and it prints each suite's size as a record stores it, what ran
and its fixed facts, raw and gzipped, with the share of what ran that
names the tests that reached each line.
Classes:
| Name | Description |
|---|---|
CoverageUnit |
One coverage record unit: either a package suite or a single test item. |
Functions:
| Name | Description |
|---|---|
expand_units |
Expand |
suites_of |
The packages with a test directory: the units the record keys. |
units_of |
The recorded units: every package's suite, then the workspace's own tests. |
own_tests |
The workspace's own tests, as a unit a test step runs; none otherwise. |
suites_that_ran |
The units the leg ran, by its scope marker and its shard's record. |
on_this_shard_units |
units less those that did not run on this shard; all on one shard of one. |
on_this_shard |
units less those that did not run on this shard; all on one shard of one. |
request |
What a reduction is asked for unit: its tests' contexts and its closure. |
request_for |
What a reduction is asked for unit (package suite or single test item). |
sizes |
unit as a record stores it: its row's bytes, the tests' share, its facts'. |
shown_sizes |
unit's size as a line shows it: what ran, its fixed facts, the tests' share. |
shown_size |
count bytes as a line shows them: |
gather_leg |
Gather the parts of every suite the leg ran and leave them for its write. |
unrecorded |
Of units, those no record in bases can supply on this leg; each says why. |
with_unstored_suites |
subset plus every suite no record can supply for this leg. |
top_up |
Run the suites or items no record can supply on this leg; the measured scope. |
Attributes:
| Name | Type | Description |
|---|---|---|
MEASURED |
|
CoverageUnit
dataclass
¶
expand_units ¶
expand_units(root: Path, units: Sequence[Package]) -> tuple[CoverageUnit, ...]
Expand selection = "on" suites into per-item units; keep others whole.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
suites_of ¶
The packages with a test directory: the units the record keys.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
units_of ¶
The recorded units: every package's suite, then the workspace's own tests.
The workspace's own tests are a unit while a test step runs them
(own_tests).
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
own_tests ¶
The workspace's own tests, as a unit a test step runs; none otherwise.
The unit (livery.workshop.workspace_suite) holds the root's set, and a test step runs it while that set holds an extension the step names (livery.workshop.tested), the rule the test step itself asks (livery.workshop.scoped_suite). A root whose set holds no such extension runs none of its own tests, so no leg leaves a part for them and no record holds them.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
suites_that_ran ¶
The units the leg ran, by its scope marker and its shard's record.
Every suite after a full gate, the named packages' suites after a
narrowed or a measured one, none after a skip; the workspace's
own tests whenever any suite ran and a test step runs them
(own_tests), since every leg that runs a suite runs them then.
On a shard of a sharded leg, those among them with a test file in
the shard's share (on_this_shard). The marker decides, never the
data's contexts: a suite whose tests reach no line that collection
had not already reached leaves no context of its own under a
first-hit tracer, and still ran.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
on_this_shard_units ¶
on_this_shard_units(root: Path, units: tuple[CoverageUnit, ...]) -> tuple[CoverageUnit, ...]
units less those that did not run on this shard; all on one shard of one.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
on_this_shard ¶
units less those that did not run on this shard; all on one shard of one.
A sharded check leg's test step runs each suite's share of its test files and records them as the items it ran, with the suites it partitioned (livery.workshop.read_shard). A suite the record names ran here where a file of it is among the items; one with no file among them ran on another shard, whose parts the gate job folds in before the union reads. A suite the record does not name, a native suite with no python test file, ran whole on the first shard with every step that does not read the shard, so the first shard expects its parts and every other shard does not. Without a record, or on one shard of one, every unit ran whole here.
Raises:
| Type | Description |
|---|---|
Failed
|
When the record does not read, naming why: a sharded leg's parts are judged by the files its shard ran. |
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
request ¶
What a reduction is asked for unit: its tests' contexts and its closure.
A package's own tests are the node ids under its tests/
directory, as the pytest extension's plugin names each test's
context; the workspace's own tests are every node id under
tests/, and their closure is every file.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
request_for ¶
What a reduction is asked for unit (package suite or single test item).
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
sizes ¶
unit as a record stores it: its row's bytes, the tests' share, its facts'.
Each raw, then gzipped at zlib's default level, the level git
stores an object at: the row; what the tests that reached each
line add to it, the row's size less its size without its parts'
contexts and each file's reached; and the fixed facts, one
file each as the record keeps them.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
shown_sizes ¶
unit's size as a line shows it: what ran, its fixed facts, the tests' share.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
shown_size ¶
count bytes as a line shows them: 1.3 MB, 412.0 KB.
The unit is chosen on the rounded figure, so a size that rounds to
a thousand kilobytes shows as 1.0 MB.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
gather_leg ¶
Gather the parts of every suite the leg ran and leave them for its write.
The parts are the ones a native suite's measurer left in the workspace and the ones the listed reductions make of the data the run left, asked for every other suite the leg ran; each suite's parts hold the files of its closure, and they ride the leg's per-run ref under the suite's closure identity, with the scope the leg measured, its size printed raw and gzipped. marker is the scope the leg measured, the gate's own marker when absent. A leg whose gate skipped (a tree already proved, or nothing affected) ran no suite, says so, and leaves its scope alone, so the union knows the leg skipped rather than died. A workspace with no packages (a project just born) runs its own tests unmetered, and they reach no package source; that leg leaves its units with no parts, so the union finds what the leg ran. A suite that ran and has no part is named and left out, and the union names it again; a leg whose suites ran and has no part of any is red, since nothing was measured. Only a CI run leaves the parts.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | |
unrecorded ¶
unrecorded(root: Path, run: RunContext, packages: tuple[Package, ...], units: tuple[Package, ...], *, bases: tuple[str, ...]) -> tuple[Package, ...]
Of units, those no record in bases can supply on this leg; each says why.
One read per record. A unit a record holds at its current closure identity is supplied, the branch's record asked before main's; a unit every record lacks or holds at another closure, an unreadable record, a leg without a label, or a closure git cannot identify runs the suite fresh and says why, so the union never lacks a suite and the records need no backfill.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
with_unstored_suites ¶
with_unstored_suites(root: Path, run: RunContext, packages: tuple[Package, ...], subset: tuple[Package, ...]) -> tuple[Package, ...]
subset plus every suite no record can supply for this leg.
A leg skips a suite only when its branch's record or main's holds the suite's parts at its current closure on this leg; the rest run fresh, and the line says why.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
top_up ¶
Run the suites or items no record can supply on this leg; the measured scope.
Inside CI alone, after the gate: a full gate ran every package suite
(checking any live-skipped test items for missing coverage parts),
and a machine's run has no record to read. A narrowed gate
(affected) ran the suites its marker names, and every other
suite (plus any live-skipped item of a ran suite) is asked of the
branch's record and main's; a gate that judged nothing (nothing)
asks the same of every suite; a gate that skipped a proved tree
(verified) asks it of every unit a listed test step runs, the
workspace's own tests among them, the record of the branch the
verified row names first. Missing units run through the test phase's
steps (livery.workshop.run_phase_over), measured, and the scope
names them. A leg with nothing to run keeps its scope.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_leg.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |