Skip to content

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Jan 16, 2026

  • Fix integration test isolation to prevent random directories in project root.

Problem

Running integration tests created random-named directories (e.g., 41SJFVD7V6, KEIN9WBF32) in the project root instead of using temporary directories.

Root cause

The main tests/integration/conftest.py was missing the prepare_test_env fixture that sets APIFY_LOCAL_STORAGE_DIR to a pytest-managed temporary directory. Without this, Crawlee's default behavior creates randomly-named directories in the current working directory.

Changes

  1. Added prepare_test_env fixture to tests/integration/conftest.py

    • Sets APIFY_LOCAL_STORAGE_DIR to tmp_path
    • Resets Actor and service locator global state between tests
    • Runs automatically via _isolate_test_environment (autouse=True)
  2. Removed duplicate tests/integration/apify_api/conftest.py

    • Contained identical fixtures now provided by parent conftest
    • Tests inherit fixtures through pytest's conftest hierarchy

Testing

After this fix, all storage directories are created under pytest's temporary directory and automatically cleaned up after test runs.


🤖 Generated with Claude Code

@vdusek vdusek added this to the 132nd sprint - Tooling team milestone Jan 16, 2026
@vdusek vdusek self-assigned this Jan 16, 2026
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jan 16, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Jan 16, 2026
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.98%. Comparing base (5953899) to head (d189059).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #739   +/-   ##
=======================================
  Coverage   81.98%   81.98%           
=======================================
  Files          46       46           
  Lines        2681     2681           
=======================================
  Hits         2198     2198           
  Misses        483      483           
Flag Coverage Δ
integration 56.13% <ø> (ø)
unit 67.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek merged commit 2c8cfdb into master Jan 16, 2026
29 checks passed
@vdusek vdusek deleted the fix-integration-tests-isolation branch January 16, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants