Skip to content

tests: keep the suite away from the developer's Login Items and autostart file - #2554

Merged
m3nu merged 2 commits into
borgbase:masterfrom
ThomasWaldmann:fix-test-login-items
Sep 7, 2026
Merged

tests: keep the suite away from the developer's Login Items and autostart file#2554
m3nu merged 2 commits into
borgbase:masterfrom
ThomasWaldmann:fix-test-login-items

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Collaborator

Description

Running the test suite changes the developer's system:

  • init_db() saves every settings row (to refresh labels/tooltips). Each save fires the post_save hook that applies the autostart setting through vorta.autostart.open_app_at_startup(). Every test session therefore calls open_app_at_startup(False), which on macOS removes any real Vorta.app entry from the user's Login Items and on Linux deletes the real ~/.config/autostart/vorta.desktop.
  • test_toggle_all_settings toggles the autostart setting on and off. On macOS the "on" half registers the test interpreter's Python.app as a Login Item, and the "off" half only removes items matching Vorta.app, so a stray "Python" Login Item is left behind.

This stubs open_app_at_startup out in pytest_configure (next to the existing D-Bus / DNS / Wi-Fi stubs) and lets test_autostart_linux, which is about that function, use the real one with XDG_CONFIG_HOME pointed at a temporary directory.

Related Issue

Noticed while working on #2551. No separate issue.

Motivation and Context

Tests must not edit the developer's Login Items or autostart configuration.

How Has This Been Tested?

  • macOS 15, Python 3.11: full pytest tests/unit run against this branch — 264 passed, 7 skipped; Login Items verified unchanged before/after the run.
  • Linux (Debian, Python 3.12, QT_QPA_PLATFORM=offscreen, in a container): pytest tests/unit/test_misc.py -k "autostart or toggle_all" — 2 passed (test_autostart_linux, test_toggle_all_settings); $HOME/.config/autostart did not exist afterwards.

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.

🤖 Generated with Claude Code

ThomasWaldmann and others added 2 commits September 5, 2026 20:00
…tart file

`init_db()` saves every settings row, which fires the post_save hook that
applies the autostart setting via `open_app_at_startup()`, and
test_toggle_all_settings toggles that setting on and off. Every test session
therefore removed any real Vorta.app Login Item on macOS (and left a stray
"Python" one behind, since the "off" path only removes Vorta.app entries) and
deleted ~/.config/autostart/vorta.desktop on Linux.

Stub `open_app_at_startup` out in pytest_configure; test_autostart_linux uses
the real function with XDG_CONFIG_HOME pointed at a temporary directory.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@m3nu
m3nu merged commit 62c53b3 into borgbase:master Sep 7, 2026
5 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the fix-test-login-items branch September 7, 2026 15:04
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