Skip to content

Remove implicit assumption about git from test_git_directory_exists#1544

Merged
skrawcz merged 1 commit intoapache:mainfrom
SummitSG-LLC:2604/fix_cli_test
Apr 7, 2026
Merged

Remove implicit assumption about git from test_git_directory_exists#1544
skrawcz merged 1 commit intoapache:mainfrom
SummitSG-LLC:2604/fix_cli_test

Conversation

@Dev-iL
Copy link
Copy Markdown
Collaborator

@Dev-iL Dev-iL commented Apr 7, 2026

While testing 1.90.0rc0 a test failed:

FAILED tests/cli/test_logic.py::test_git_directory_exists - OSError: fatal: not a git repository (or any of the parent directories): .git

This is because the test_git_directory_exists() integration-style test currently depends on the checkout being a real Git worktree. This PR updates the test to unit-test get_git_base_directory() by mocking subprocess.run, which makes it stable under uv run tarball/sdist environments.

How I tested this

Test was failing, now it passes.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@Dev-iL Dev-iL changed the title Mock .git folder in cli test Remove implicit assumption about git from test_git_directory_exists Apr 7, 2026
@skrawcz skrawcz merged commit e1aa04f into apache:main Apr 7, 2026
5 of 6 checks passed
@Dev-iL Dev-iL deleted the 2604/fix_cli_test branch April 7, 2026 19:03
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