21
21
PACKAGES_TO_PRIME_PATH = TEST_DIR_ROOT / "primer/packages_to_prime.json"
22
22
FIXTURES_PATH = HERE / "fixtures"
23
23
24
- PRIMER_CURRENT_INTERPRETER = (3 , 10 )
24
+ PRIMER_CURRENT_INTERPRETER = (3 , 11 )
25
25
26
26
DEFAULT_ARGS = ["python tests/primer/__main__.py" , "compare" , "--commit=v2.14.2" ]
27
27
@@ -49,7 +49,7 @@ class TestPrimer:
49
49
[
50
50
pytest .param (p , id = str (p .relative_to (FIXTURES_PATH )))
51
51
for p in FIXTURES_PATH .iterdir ()
52
- if p .is_dir ()
52
+ if p .is_dir () and p . name != "batched" # tested separately
53
53
],
54
54
)
55
55
def test_compare (self , directory : Path ) -> None :
@@ -58,6 +58,15 @@ def test_compare(self, directory: Path) -> None:
58
58
Directory in 'fixtures/' with 'main.json', 'pr.json' and 'expected.txt'."""
59
59
self .__assert_expected (directory )
60
60
61
+ def test_compare_batched (self ) -> None :
62
+ fixture = FIXTURES_PATH / "batched"
63
+ self .__assert_expected (
64
+ fixture ,
65
+ fixture / "main_BATCHIDX.json" ,
66
+ fixture / "pr_BATCHIDX.json" ,
67
+ batches = 2 ,
68
+ )
69
+
61
70
def test_truncated_compare (self ) -> None :
62
71
"""Test for the truncation of comments that are too long."""
63
72
max_comment_length = 525
@@ -77,6 +86,7 @@ def __assert_expected(
77
86
main : Path | None = None ,
78
87
pr : Path | None = None ,
79
88
expected_file : Path | None = None ,
89
+ batches : int = 0 ,
80
90
) -> str :
81
91
if main is None :
82
92
main = directory / "main.json"
@@ -85,6 +95,8 @@ def __assert_expected(
85
95
if expected_file is None :
86
96
expected_file = directory / "expected.txt"
87
97
new_argv = [* DEFAULT_ARGS , f"--base-file={ main } " , f"--new-file={ pr } " ]
98
+ if batches :
99
+ new_argv .append (f"--batches={ batches } " )
88
100
with patch ("sys.argv" , new_argv ):
89
101
Primer (PRIMER_DIRECTORY , PACKAGES_TO_PRIME_PATH ).run ()
90
102
with open (PRIMER_DIRECTORY / "comment.txt" , encoding = "utf8" ) as f :
0 commit comments