Skip to content

fix(test): isolate CLI tests from user database and xfail RLIMIT_AS on macOS#611

Merged
lewisjared merged 2 commits intomainfrom
fix/test-isolation-and-macos-rlimit
Apr 5, 2026
Merged

fix(test): isolate CLI tests from user database and xfail RLIMIT_AS on macOS#611
lewisjared merged 2 commits intomainfrom
fix/test-isolation-and-macos-rlimit

Conversation

@lewisjared
Copy link
Copy Markdown
Contributor

Description

Fix 29 failing tests caused by two issues:

  1. CLI test isolation: The invoke_cli fixture did not depend on the config fixture, so CLI tests hit the user's real database instead of an isolated temp one. If the user's database had a different alembic revision than the codebase (e.g. a removed migration), tests would fail with Can't locate revision. Fixed by making invoke_cli depend on config.

  2. macOS RLIMIT_AS: test_memory_limit_func calls resource.setrlimit(RLIMIT_AS) which is not supported on macOS. Marked as xfail on Darwin.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

…n macOS

The invoke_cli fixture now depends on the config fixture so every CLI
test uses an isolated configuration directory and database instead of
the user's real one. This prevents failures when the user's database
has a different alembic revision than the codebase expects.

Mark test_memory_limit_func as xfail on macOS where RLIMIT_AS is not
supported by the kernel.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes test flakiness/failures stemming from (1) CLI tests unintentionally using a developer’s real local REF configuration/database, and (2) a memory-limit test that relies on RLIMIT_AS, which is unsupported on macOS.

Changes:

  • Updated the invoke_cli pytest fixture to depend on the config fixture so CLI runs always use an isolated, per-test configuration directory/database.
  • Marked the RLIMIT_AS-based memory limit test as xfail on Darwin/macOS.
  • Added a changelog entry describing both test fixes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/climate-ref/tests/unit/executor/test_hpc_executor.py Marks test_memory_limit_func as xfail on macOS where RLIMIT_AS isn’t supported; minor cleanup of expected-bytes placement.
packages/climate-ref/src/climate_ref/conftest_plugin.py Ensures invoke_cli triggers the isolated per-test config setup so CLI tests don’t touch user state.
changelog/611.fix.md Documents the two test stability fixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core 93.17% <ø> (-0.01%) ⬇️
providers 91.85% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lewisjared lewisjared merged commit c0c0521 into main Apr 5, 2026
30 checks passed
@lewisjared lewisjared deleted the fix/test-isolation-and-macos-rlimit branch April 5, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants