Skip to content

fix: make PYTHONPATH test assertion repo-name agnostic#44

Merged
simongonzalezdc merged 2 commits into
mainfrom
fix/pythonpath-test-assertion
May 27, 2026
Merged

fix: make PYTHONPATH test assertion repo-name agnostic#44
simongonzalezdc merged 2 commits into
mainfrom
fix/pythonpath-test-assertion

Conversation

@simongonzalezdc
Copy link
Copy Markdown
Member

@simongonzalezdc simongonzalezdc commented May 27, 2026

Problem

test_build_db_propagates_pythonpath fails on CI because it asserts PYTHONPATH contains "archaeology" or "DEV-ARCH" — hardcoded local directory names. The CI runner clones into devarch-framework/, so neither substring matches.

Fix

Replace the hardcoded directory-name assertion with a check that PYTHONPATH is an absolute path — which is the actual invariant the CLI code guarantees (it sets _pkg_root = Path(__file__).parent.parent).

Evidence


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Tests
    • Strengthened a test to validate that the PYTHONPATH provided to a subprocess begins with an absolute path segment, making the check platform-agnostic and less reliant on environment-specific substrings. This improves robustness of path validation across different systems and setups.

Review Change Stack

The test was asserting that PYTHONPATH contains "archaeology" or
"DEV-ARCH" — hardcoded local directory names. In CI the repo is cloned
as "devarch-framework", so neither substring matched.

Replace with an assertion that PYTHONPATH is an absolute path (which is
the actual invariant the CLI code guarantees via Path(__file__).parent.parent).

Fixes #39
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 77aeac45-8b50-4069-a39b-9046c00c8327

📥 Commits

Reviewing files that changed from the base of the PR and between bb5fca1 and e9fa64e.

📒 Files selected for processing (1)
  • tests/test_cli_coverage.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_cli_coverage.py

📝 Walkthrough

Walkthrough

This PR updates the CLI coverage test to assert that the first segment of the PYTHONPATH environment variable (split on the platform path separator) is an absolute filesystem path, replacing repository-specific substring checks.

Changes

CLI Coverage Test Robustness

Layer / File(s) Summary
PYTHONPATH validation in CLI coverage test
tests/test_cli_coverage.py
The test_build_db_propagates_pythonpath assertion now parses the delimiter-separated PYTHONPATH and verifies the first path segment is absolute using os.path.isabs, instead of matching hardcoded substrings like "archaeology" or "DEV-ARCH".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related issues

  • #46: Both changes modify the PYTHONPATH test assertion to be repository-name-agnostic by checking for an absolute path segment rather than repo-specific substrings.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: making a PYTHONPATH test assertion work regardless of repository name, which directly addresses the problem documented in issue #39.
Description check ✅ Passed The description clearly outlines the problem (hardcoded directory names fail on CI), the fix (check for absolute path instead), and includes evidence. However, it does not address the required Empower Orchestrator checklist from the template.
Linked Issues check ✅ Passed The PR directly addresses issue #39 by fixing the failing test that was causing CI failures across macOS, Ubuntu, and Windows runners, replacing hardcoded directory-name assertions with a cross-platform absolute path check.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the failing test in tests/test_cli_coverage.py, directly addressing the CI failure root cause identified in issue #39 with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pythonpath-test-assertion

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_cli_coverage.py`:
- Around line 404-406: The current assertion splits PYTHONPATH token pp on ":"
first which breaks Windows drive letters; update the assertion to split on the
platform path separator (use os.pathsep) instead of ":" so you check the first
path component correctly (replace pp.split(":")[0].split(";")[0] with
pp.split(os.pathsep)[0] when calling os.path.isabs). Ensure the change
references the pp variable and the assertion in tests/test_cli_coverage.py.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 248deb3c-ea65-4d8b-ae20-eb86f468e8a6

📥 Commits

Reviewing files that changed from the base of the PR and between 4f5a2b1 and bb5fca1.

📒 Files selected for processing (1)
  • tests/test_cli_coverage.py

Comment thread tests/test_cli_coverage.py Outdated
@simongonzalezdc simongonzalezdc merged commit f98035e into main May 27, 2026
12 checks passed
@simongonzalezdc simongonzalezdc deleted the fix/pythonpath-test-assertion branch May 27, 2026 07:37
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.

[pipeline][HIGH] CI fails on default branch

1 participant