crackerjack 0.21.3__py3-none-any.whl → 0.21.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crackerjack/.ruff_cache/0.12.1/5056746222905752453 +0 -0
- crackerjack/crackerjack.py +83 -36
- crackerjack/pyproject.toml +1 -1
- {crackerjack-0.21.3.dist-info → crackerjack-0.21.4.dist-info}/METADATA +1 -1
- {crackerjack-0.21.3.dist-info → crackerjack-0.21.4.dist-info}/RECORD +8 -8
- {crackerjack-0.21.3.dist-info → crackerjack-0.21.4.dist-info}/WHEEL +0 -0
- {crackerjack-0.21.3.dist-info → crackerjack-0.21.4.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.21.3.dist-info → crackerjack-0.21.4.dist-info}/licenses/LICENSE +0 -0
Binary file
|
crackerjack/crackerjack.py
CHANGED
@@ -657,19 +657,30 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
657
657
|
self.console.print("\nCleaning tests directory...\n")
|
658
658
|
self.code_cleaner.clean_files(tests_dir)
|
659
659
|
|
660
|
-
def
|
661
|
-
test = ["pytest"]
|
662
|
-
project_size = self._detect_project_size()
|
660
|
+
def _get_test_timeout(self, options: OptionsProtocol, project_size: str) -> int:
|
663
661
|
if options.test_timeout > 0:
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
662
|
+
return options.test_timeout
|
663
|
+
return (
|
664
|
+
360 if project_size == "large" else 240 if project_size == "medium" else 120
|
665
|
+
)
|
666
|
+
|
667
|
+
def _add_ai_agent_flags(
|
668
|
+
self, test: list[str], options: OptionsProtocol, test_timeout: int
|
669
|
+
) -> None:
|
670
|
+
test.extend(
|
671
|
+
[
|
672
|
+
"--junitxml=test-results.xml",
|
673
|
+
"--cov-report=json:coverage.json",
|
674
|
+
"--tb=short",
|
675
|
+
"--no-header",
|
676
|
+
"--quiet",
|
677
|
+
f"--timeout={test_timeout}",
|
678
|
+
]
|
679
|
+
)
|
680
|
+
if options.benchmark or options.benchmark_regression:
|
681
|
+
test.append("--benchmark-json=benchmark.json")
|
682
|
+
|
683
|
+
def _add_standard_flags(self, test: list[str], test_timeout: int) -> None:
|
673
684
|
test.extend(
|
674
685
|
[
|
675
686
|
"--capture=fd",
|
@@ -680,17 +691,22 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
680
691
|
f"--timeout={test_timeout}",
|
681
692
|
]
|
682
693
|
)
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
+
|
695
|
+
def _add_benchmark_flags(self, test: list[str], options: OptionsProtocol) -> None:
|
696
|
+
if options.benchmark:
|
697
|
+
test.extend(["--benchmark", "--benchmark-autosave"])
|
698
|
+
if options.benchmark_regression:
|
699
|
+
test.extend(
|
700
|
+
[
|
701
|
+
"--benchmark-regression",
|
702
|
+
f"--benchmark-regression-threshold={options.benchmark_regression_threshold}",
|
703
|
+
]
|
704
|
+
)
|
705
|
+
|
706
|
+
def _add_worker_flags(
|
707
|
+
self, test: list[str], options: OptionsProtocol, project_size: str
|
708
|
+
) -> None:
|
709
|
+
if options.test_workers > 0:
|
694
710
|
if options.test_workers == 1:
|
695
711
|
test.append("-vs")
|
696
712
|
else:
|
@@ -701,6 +717,20 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
701
717
|
test.extend(["-xvs", "-n", "auto"])
|
702
718
|
else:
|
703
719
|
test.append("-xvs")
|
720
|
+
|
721
|
+
def _prepare_pytest_command(self, options: OptionsProtocol) -> list[str]:
|
722
|
+
test = ["pytest"]
|
723
|
+
project_size = self._detect_project_size()
|
724
|
+
test_timeout = self._get_test_timeout(options, project_size)
|
725
|
+
if getattr(options, "ai_agent", False):
|
726
|
+
self._add_ai_agent_flags(test, options, test_timeout)
|
727
|
+
else:
|
728
|
+
self._add_standard_flags(test, test_timeout)
|
729
|
+
if options.benchmark or options.benchmark_regression:
|
730
|
+
self._add_benchmark_flags(test, options)
|
731
|
+
else:
|
732
|
+
self._add_worker_flags(test, options, project_size)
|
733
|
+
|
704
734
|
return test
|
705
735
|
|
706
736
|
def _detect_project_size(self) -> str:
|
@@ -717,22 +747,39 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
717
747
|
return "medium"
|
718
748
|
else:
|
719
749
|
return "small"
|
720
|
-
except
|
750
|
+
except (OSError, PermissionError):
|
721
751
|
return "medium"
|
722
752
|
|
753
|
+
def _print_ai_agent_files(self, options: t.Any) -> None:
|
754
|
+
if getattr(options, "ai_agent", False):
|
755
|
+
self.console.print("📄 Structured test results: test-results.xml")
|
756
|
+
self.console.print("📊 Coverage report: coverage.json")
|
757
|
+
if options.benchmark or options.benchmark_regression:
|
758
|
+
self.console.print("⏱️ Benchmark results: benchmark.json")
|
759
|
+
|
760
|
+
def _handle_test_failure(self, result: t.Any, options: t.Any) -> None:
|
761
|
+
if result.stderr:
|
762
|
+
self.console.print(result.stderr)
|
763
|
+
self.console.print("\n\n❌ Tests failed. Please fix errors.\n")
|
764
|
+
self._print_ai_agent_files(options)
|
765
|
+
raise SystemExit(1)
|
766
|
+
|
767
|
+
def _handle_test_success(self, options: t.Any) -> None:
|
768
|
+
self.console.print("\n\n✅ Tests passed successfully!\n")
|
769
|
+
self._print_ai_agent_files(options)
|
770
|
+
|
723
771
|
def _run_tests(self, options: t.Any) -> None:
|
724
|
-
if options.test:
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
self.console.print("\n\n✅ Tests passed successfully!\n")
|
772
|
+
if not options.test:
|
773
|
+
return
|
774
|
+
self.console.print("\n\nRunning tests...\n")
|
775
|
+
test_command = self._prepare_pytest_command(options)
|
776
|
+
result = self.execute_command(test_command, capture_output=True, text=True)
|
777
|
+
if result.stdout:
|
778
|
+
self.console.print(result.stdout)
|
779
|
+
if result.returncode > 0:
|
780
|
+
self._handle_test_failure(result, options)
|
781
|
+
else:
|
782
|
+
self._handle_test_success(options)
|
736
783
|
|
737
784
|
def _bump_version(self, options: OptionsProtocol) -> None:
|
738
785
|
for option in (options.publish, options.bump):
|
crackerjack/pyproject.toml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
crackerjack-0.21.
|
2
|
-
crackerjack-0.21.
|
3
|
-
crackerjack-0.21.
|
4
|
-
crackerjack-0.21.
|
1
|
+
crackerjack-0.21.4.dist-info/METADATA,sha256=wS3pafPCEzG1goow1kGqleIoqGjAdaYBJO5XmuMQ9aU,26414
|
2
|
+
crackerjack-0.21.4.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
crackerjack-0.21.4.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.21.4.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
5
5
|
crackerjack/.gitignore,sha256=FOLrDV-tuHpwof310aOi6cWOkJXeVI_gvWvg_paDzs4,199
|
6
6
|
crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
|
7
7
|
crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
|
@@ -34,7 +34,7 @@ crackerjack/.ruff_cache/0.11.7/10386934055395314831,sha256=lBNwN5zAgM4OzbkXIOzCc
|
|
34
34
|
crackerjack/.ruff_cache/0.11.7/3557596832929915217,sha256=fKlwUbsvT3YIKV6UR-aA_i64lLignWeVfVu-MMmVbU0,207
|
35
35
|
crackerjack/.ruff_cache/0.11.8/530407680854991027,sha256=xAMAL3Vu_HR6M-h5ojCTaak0By5ii8u-14pXULLgLqw,224
|
36
36
|
crackerjack/.ruff_cache/0.12.0/5056746222905752453,sha256=MqrIT5qymJcgAOBZyn-TvYoGCFfDFCgN9IwSULq8n14,256
|
37
|
-
crackerjack/.ruff_cache/0.12.1/5056746222905752453,sha256=
|
37
|
+
crackerjack/.ruff_cache/0.12.1/5056746222905752453,sha256=ksDcvUi9t_w2SUbEhH8Yk-ArZbLaWKIkwnKqJ0Q9ceA,256
|
38
38
|
crackerjack/.ruff_cache/0.2.0/10047773857155985907,sha256=j9LNa_RQ4Plor7go1uTYgz17cEENKvZQ-dP6b9MX0ik,248
|
39
39
|
crackerjack/.ruff_cache/0.2.1/8522267973936635051,sha256=u_aPBMibtAp_iYvLwR88GMAECMcIgHezxMyuapmU2P4,248
|
40
40
|
crackerjack/.ruff_cache/0.2.2/18053836298936336950,sha256=Xb_ebP0pVuUfSqPEZKlhQ70so_vqkEfMYpuHQ06iR5U,248
|
@@ -64,9 +64,9 @@ crackerjack/.ruff_cache/0.9.9/8843823720003377982,sha256=e4ymkXfQsUg5e_mtO34xTsa
|
|
64
64
|
crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
65
65
|
crackerjack/__init__.py,sha256=8tBSPAru_YDuPpjz05cL7pNbZjYFoRT_agGd_FWa3gY,839
|
66
66
|
crackerjack/__main__.py,sha256=AknITUlFjq3YUK9s2xeL62dM0GN82JBQyDkPzQ_hCUg,6561
|
67
|
-
crackerjack/crackerjack.py,sha256=
|
67
|
+
crackerjack/crackerjack.py,sha256=H88eTvf51jOmFK6oXxtCpyDLtOTJqrUgQ-AKax9vnUY,33310
|
68
68
|
crackerjack/errors.py,sha256=QEPtVuMtKtQHuawgr1ToMaN1KbUg5h9-4mS33YB5Znk,4062
|
69
69
|
crackerjack/interactive.py,sha256=5KXKSvWKttLvHcI1L4VEDc3Rb-ZpHBOl_Qr7lhD-O4Q,16262
|
70
70
|
crackerjack/py313.py,sha256=buYE7LO11Q64ffowEhTZRFQoAGj_8sg3DTlZuv8M9eo,5890
|
71
|
-
crackerjack/pyproject.toml,sha256=
|
72
|
-
crackerjack-0.21.
|
71
|
+
crackerjack/pyproject.toml,sha256=2l1IPJxiUCuMjaSeo45RRBTp1AaghJonP1BAPI9wTi0,4988
|
72
|
+
crackerjack-0.21.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|