Sync ctx 593b5ae (part 3)
Browse filesGitHub commit: 593b5ae55c168e6f2eb1668488ff7763446cc54e
src/tests/test_ci_classifier.py
CHANGED
|
@@ -620,6 +620,20 @@ def test_ci_required_allows_full_matrix_skip_on_pr_only() -> None:
|
|
| 620 |
assert failed_required_jobs(needs, event_name="push") == {"test": "skipped"}
|
| 621 |
|
| 622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
def test_ci_required_allows_heavy_jobs_to_skip_on_docs_only_pr() -> None:
|
| 624 |
needs = _required_needs(
|
| 625 |
classify={
|
|
@@ -876,3 +890,13 @@ def test_workflow_runs_focused_telemetry_enterprise_gate() -> None:
|
|
| 876 |
assert "src/tests/test_enterprise_telemetry.py" in workflow
|
| 877 |
assert "src/tests/test_harness_cli_run.py" in workflow
|
| 878 |
assert '-k "telemetry or runtime_lifecycle"' in workflow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
assert failed_required_jobs(needs, event_name="push") == {"test": "skipped"}
|
| 621 |
|
| 622 |
|
| 623 |
+
def test_ci_required_rejects_full_matrix_skip_on_ci_changed_pr() -> None:
|
| 624 |
+
needs = _required_needs(
|
| 625 |
+
classify={
|
| 626 |
+
"result": "success",
|
| 627 |
+
"outputs": {"ci_changed": "true"},
|
| 628 |
+
},
|
| 629 |
+
test={"result": "skipped"},
|
| 630 |
+
)
|
| 631 |
+
|
| 632 |
+
assert failed_required_jobs(needs, event_name="pull_request") == {
|
| 633 |
+
"test": "skipped",
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
|
| 637 |
def test_ci_required_allows_heavy_jobs_to_skip_on_docs_only_pr() -> None:
|
| 638 |
needs = _required_needs(
|
| 639 |
classify={
|
|
|
|
| 890 |
assert "src/tests/test_enterprise_telemetry.py" in workflow
|
| 891 |
assert "src/tests/test_harness_cli_run.py" in workflow
|
| 892 |
assert '-k "telemetry or runtime_lifecycle"' in workflow
|
| 893 |
+
|
| 894 |
+
|
| 895 |
+
def test_workflow_runs_full_pytest_matrix_for_ci_changed_prs() -> None:
|
| 896 |
+
workflow = Path(".github/workflows/test.yml").read_text(encoding="utf-8")
|
| 897 |
+
pytest_job = workflow.split("\n test:\n", maxsplit=1)[1].split(
|
| 898 |
+
"\n contract-compat:", maxsplit=1
|
| 899 |
+
)[0]
|
| 900 |
+
|
| 901 |
+
assert "needs: classify" in pytest_job
|
| 902 |
+
assert "needs.classify.outputs.ci_changed == 'true'" in pytest_job
|
src/tests/test_no_mistakes_env.py
CHANGED
|
@@ -5,6 +5,7 @@ import shutil
|
|
| 5 |
import subprocess
|
| 6 |
from pathlib import Path
|
| 7 |
|
|
|
|
| 8 |
import yaml
|
| 9 |
|
| 10 |
|
|
@@ -13,6 +14,13 @@ def _write_executable(path: Path, content: str) -> None:
|
|
| 13 |
path.chmod(0o755)
|
| 14 |
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
def test_no_mistakes_wrapper_prefers_valid_worktree_venv_over_broken_override(
|
| 17 |
tmp_path: Path,
|
| 18 |
) -> None:
|
|
@@ -75,6 +83,7 @@ def test_no_mistakes_repo_config_defines_deterministic_commands() -> None:
|
|
| 75 |
assert config["auto_fix"]["lint"] == 3
|
| 76 |
|
| 77 |
|
|
|
|
| 78 |
def test_no_mistakes_run_script_uses_trusted_python_for_configured_commands(
|
| 79 |
tmp_path: Path,
|
| 80 |
) -> None:
|
|
|
|
| 5 |
import subprocess
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
+
import pytest
|
| 9 |
import yaml
|
| 10 |
|
| 11 |
|
|
|
|
| 14 |
path.chmod(0o755)
|
| 15 |
|
| 16 |
|
| 17 |
+
posix_shell_only = pytest.mark.skipif(
|
| 18 |
+
os.name == "nt",
|
| 19 |
+
reason="POSIX shell wrapper tests require a POSIX bash, not WSL bash on Windows.",
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@posix_shell_only
|
| 24 |
def test_no_mistakes_wrapper_prefers_valid_worktree_venv_over_broken_override(
|
| 25 |
tmp_path: Path,
|
| 26 |
) -> None:
|
|
|
|
| 83 |
assert config["auto_fix"]["lint"] == 3
|
| 84 |
|
| 85 |
|
| 86 |
+
@posix_shell_only
|
| 87 |
def test_no_mistakes_run_script_uses_trusted_python_for_configured_commands(
|
| 88 |
tmp_path: Path,
|
| 89 |
) -> None:
|