File size: 1,077 Bytes
370fed4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from stackgo.scripts import build_stack_dataset


def test_dry_run_builds_all_stages(tmp_path, monkeypatch):
    calls = []
    monkeypatch.setattr(build_stack_dataset, "_run", lambda name, command, dry_run: calls.append((name, command)))
    monkeypatch.setattr("sys.argv", [
        "build-stack-dataset",
        "--index-dir", str(tmp_path / "index"),
        "--output", str(tmp_path / "dataset"),
        "--filtered-index-dir", str(tmp_path / "filtered"),
        "--content-dir", str(tmp_path / "contents"),
        "--min-stars-exclusive", "5",
        "--max-stars-exclusive", "11",
        "--skip-index-download",
        "--max-source-shards", "1",
        "--max-files", "3",
        "--with-samples",
        "--jobs", "2",
        "--dry-run",
    ])
    build_stack_dataset.main()
    assert [name for name, _ in calls] == ["filter", "contents", "export", "samples"]
    export_command = calls[2][1]
    assert "--star-events-count-exclusive" in export_command
    assert "--star-events-count-max-exclusive" in export_command
    assert "11" in export_command