- Add TSF file naming constraint to syntax/02_core_model.md - Clarify semicolon rules: syntax facts vs style preferences - Separate control flow end semicolon rules (syntax allows both) - Add function body semicolon requirements to syntax/05_functions_and_calls.md - Move style preferences to code_style.md (control flow end semicolons) - Remove cross-references from syntax docs to maintain independence - Enhance Gitea workflow emoji for better CI output readability - Fix CI test path from tests/ to test/ - Organize agent test results under test/agent/result/ directory - Add complete Chinese translation of test cases (test_cases_zh.md) - Clean up .gitignore to use unified test/agent/result/ directory - Remove obsolete agent test artifacts (REPORTS_LOCATION.md, old results) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
2.1 KiB
Python
50 lines
2.1 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
TEST_WORKFLOW = ROOT / ".gitea" / "workflows" / "test.yml"
|
|
STANDARDS_WORKFLOW = ROOT / ".gitea" / "workflows" / "standards-check.yml"
|
|
UPDATE_THIRDPARTY_WORKFLOW = ROOT / ".gitea" / "workflows" / "update-thirdparty-skills.yml"
|
|
TEMPLATE_STANDARDS_WORKFLOW = (
|
|
ROOT / "templates" / "ci" / "gitea" / ".gitea" / "workflows" / "standards-check.yml"
|
|
)
|
|
|
|
|
|
class GiteaWorkflowBootstrapTests(unittest.TestCase):
|
|
def test_repo_workflows_do_not_call_repo_local_prepare_script_before_checkout(self):
|
|
for workflow in (TEST_WORKFLOW, STANDARDS_WORKFLOW):
|
|
text = workflow.read_text(encoding="utf-8")
|
|
with self.subTest(workflow=workflow.name):
|
|
self.assertNotIn("bash .gitea/ci/prepare_repo.sh", text)
|
|
self.assertIn('git clone "$REPO_URL" "$REPO_DIR"', text)
|
|
self.assertIn('echo "REPO_DIR=$REPO_DIR" >> "$GITHUB_ENV"', text)
|
|
|
|
def test_workflows_use_isolated_repo_dirs_per_job(self):
|
|
for workflow in (
|
|
TEST_WORKFLOW,
|
|
STANDARDS_WORKFLOW,
|
|
UPDATE_THIRDPARTY_WORKFLOW,
|
|
TEMPLATE_STANDARDS_WORKFLOW,
|
|
):
|
|
text = workflow.read_text(encoding="utf-8")
|
|
with self.subTest(workflow=workflow.name):
|
|
self.assertNotIn('REPO_DIR="${WORKSPACE_DIR}/${REPO_NAME}"', text)
|
|
self.assertNotIn('REPO_DIR="${{ env.WORKSPACE_DIR }}/$REPO_NAME"', text)
|
|
self.assertIn('mktemp -d', text)
|
|
self.assertTrue(
|
|
'mkdir -p "$WORKSPACE_DIR"' in text
|
|
or 'mkdir -p "${{ env.WORKSPACE_DIR }}"' in text
|
|
)
|
|
self.assertIn('echo "REPO_DIR=$REPO_DIR" >>', text)
|
|
self.assertIn("if: always()", text)
|
|
self.assertIn('rm -rf "$REPO_DIR"', text)
|
|
|
|
def test_test_workflow_installs_tomli_for_python_template_validation(self):
|
|
text = TEST_WORKFLOW.read_text(encoding="utf-8")
|
|
self.assertIn("python3 -m pip install yamllint tomli", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|