Skip to content

Remove test workaround from list_repo.py, add proper error handling (#2392)#2393

Open
mr-raj12 wants to merge 1 commit intoborgbase:masterfrom
mr-raj12:fix/remove-test-workaround-list-repo-2392
Open

Remove test workaround from list_repo.py, add proper error handling (#2392)#2393
mr-raj12 wants to merge 1 commit intoborgbase:masterfrom
mr-raj12:fix/remove-test-workaround-list-repo-2392

Conversation

@mr-raj12
Copy link
Contributor

@mr-raj12 mr-raj12 commented Feb 5, 2026

Description

Remove test-specific workaround from production code and fix the underlying test infrastructure issue.
Changes:

  • src/vorta/borg/list_repo.py: Remove if not result['data']: result['data'] = {} workaround, add proper error handling with logging for unexpected data
    types
  • tests/unit/conftest.py: Add mock_borg_popen fixture that provides fresh file handles for each Popen call, supporting job chaining scenarios
  • tests/unit/test_archives.py: Update test_repo_prune to use new fixture (prune triggers list refresh = 2 jobs)

Related Issue

Closes #2392

Motivation and Context

Production code contained a test-specific workaround that silently masked potential errors. The root cause was test infrastructure reusing file handles across
chained jobs - when job A (prune) read from a file handle, job B (list) would get empty content because the file position was at EOF.

How Has This Been Tested?

  • Verified same tests pass/fail on both master and fix branch (no regressions)
  • Linting passes (ruff check)
  • Full verification will happen on CI (Linux/macOS) since the affected tests use os.set_blocking() which doesn't work on Windows

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

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.

Remove test workaround from production code in borg/list_repo.py:42

1 participant