(
ext,
files,
batch_size=None,
jobs=1,
on_start=None,
on_result=None,
manifest=None,
)
| 2826 | mock_make_ext.return_value = MagicMock() |
| 2827 | |
| 2828 | def _fake_run( |
| 2829 | ext, |
| 2830 | files, |
| 2831 | batch_size=None, |
| 2832 | jobs=1, |
| 2833 | on_start=None, |
| 2834 | on_result=None, |
| 2835 | manifest=None, |
| 2836 | ): |
| 2837 | batch = BatchResult() |
| 2838 | # ok: SUCCESS with 4 options |
| 2839 | ok = files[0] |
| 2840 | mp = _make_manpage_from_source(mock_source(ok)) |
| 2841 | mp.options = [ |
| 2842 | Option(text=f"-{i}", short=[f"-{i}"], long=[], has_argument=False) |
| 2843 | for i in range(4) |
| 2844 | ] |
| 2845 | batch.n_succeeded += 1 |
| 2846 | batch.stats.input_tokens = 1234 |
| 2847 | batch.stats.output_tokens = 567 |
| 2848 | batch.stats.reasoning_tokens = 89 |
| 2849 | batch.stats.chunks = 2 |
| 2850 | batch.stats.plain_text_len = 4096 |
| 2851 | if on_result: |
| 2852 | on_result( |
| 2853 | ok, |
| 2854 | ExtractionResult( |
| 2855 | gz_path=ok, |
| 2856 | outcome=ExtractionOutcome.SUCCESS, |
| 2857 | mp=mp, |
| 2858 | raw=_make_raw(sha256=ok), |
| 2859 | stats=ExtractionStats(), |
| 2860 | ), |
| 2861 | ) |
| 2862 | # bad: FAILED with line-span coverage classification |
| 2863 | bad = files[1] |
| 2864 | batch.n_failed += 1 |
| 2865 | if on_result: |
| 2866 | on_result( |
| 2867 | bad, |
| 2868 | ExtractionResult( |
| 2869 | gz_path=bad, |
| 2870 | outcome=ExtractionOutcome.FAILED, |
| 2871 | error="line-span coverage 4.5x exceeds 3.0x limit", |
| 2872 | reason_class=FailureReason.LINE_SPAN_COVERAGE, |
| 2873 | ), |
| 2874 | ) |
| 2875 | # skipped: SKIPPED with manpage_too_large classification |
| 2876 | sk = files[2] |
| 2877 | batch.n_skipped += 1 |
| 2878 | if on_result: |
| 2879 | on_result( |
| 2880 | sk, |
| 2881 | ExtractionResult( |
| 2882 | gz_path=sk, |
| 2883 | outcome=ExtractionOutcome.SKIPPED, |
| 2884 | error="manpage too large (600,000 chars, limit 500,000)", |
| 2885 | reason_class=FailureReason.MANPAGE_TOO_LARGE, |
nothing calls this directly
no test coverage detected