From bcb735a2216303633d4b9a58bae3a7a4347864e2 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 8 May 2026 09:46:57 +0200 Subject: [PATCH] ci: fix e2e templates tests failing on mise shim cwd resolution The apify/setup-apify-cli-action installs apify-cli via a mise shim that resolves the version from cwd. Tests that subprocess into pytest's tmp_path under /tmp couldn't find a mise config and failed with "No version is set for shim: apify". Move pytest's basetemp under the project root so mise's parent traversal finds the action's mise.toml in $GITHUB_WORKSPACE, and set GIT_CEILING_DIRECTORIES on apify push so git doesn't reach the project's .git/. --- .gitignore | 1 + pyproject.toml | 1 + .../project_template/test_static_crawlers_templates.py | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 85e418b0c1..13a812adfc 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ GEMINI.local.md # Cache __pycache__ .pytest_cache +.pytest-tmp .ruff_cache .ty_cache .uv-cache diff --git a/pyproject.toml b/pyproject.toml index 699d68dffe..08a2d48136 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -337,6 +337,7 @@ uv run pytest \ cmd = """ uv run pytest \ --numprocesses=${TESTS_CONCURRENCY:-auto} \ + --basetemp=./.pytest-tmp \ tests/e2e/project_template """ diff --git a/tests/e2e/project_template/test_static_crawlers_templates.py b/tests/e2e/project_template/test_static_crawlers_templates.py index 1ff1895fc5..bd40f0c8ac 100644 --- a/tests/e2e/project_template/test_static_crawlers_templates.py +++ b/tests/e2e/project_template/test_static_crawlers_templates.py @@ -86,7 +86,15 @@ async def test_static_crawler_actor_at_apify( ) subprocess.run(['apify', 'init', '-y', actor_name], capture_output=True, check=True, cwd=tmp_path / actor_name) # noqa: ASYNC221, S603, S607 - build_process = subprocess.run(['apify', 'push'], capture_output=True, check=False, cwd=tmp_path / actor_name) # noqa: ASYNC221, S607 + build_process = subprocess.run( # noqa: ASYNC221 + ['apify', 'push'], # noqa: S607 + capture_output=True, + check=False, + cwd=tmp_path / actor_name, + # Prevent git from walking up into the surrounding project's .git/ when running under + # a basetemp inside the repo (see --basetemp in the e2e-templates-tests poe task). + env={**os.environ, 'GIT_CEILING_DIRECTORIES': str(tmp_path)}, + ) # Get actor ID from build log actor_id_regexp = re.compile(r'https:\/\/console\.apify\.com\/actors\/(.*)#\/builds\/\d*\.\d*\.\d*')