2828
2929# Marker applied to any test that patches pwd.getpwuid (Linux/macOS only)
3030skip_on_windows = pytest .mark .skipif (
31- sys .platform == 'win32' ,
32- reason = "pwd module is not available on Windows; Flatpak does not exist on Windows"
31+ sys .platform == 'win32' , reason = "pwd module is not available on Windows; Flatpak does not exist on Windows"
3332)
3433
3534
@@ -64,6 +63,7 @@ def mock_successful_import(mocker):
6463# 1. Core fix: pwd.getpwuid is used, not os.path.expanduser / HOME env var
6564# ---------------------------------------------------------------------------
6665
66+
6767@skip_on_windows
6868def test_pwd_getpwuid_is_called (qapp , tmp_path , mocker ):
6969 """
@@ -120,22 +120,20 @@ def test_expanduser_misses_file_when_home_overridden(tmp_path, monkeypatch):
120120
121121 # Old approach — resolves to sandboxed HOME, file not found
122122 old_path = Path (os .path .expanduser ("~" )) / ".vorta-init.json"
123- assert not old_path .exists (), (
124- "expanduser resolves to the sandboxed HOME, missing the real file"
125- )
123+ assert not old_path .exists (), "expanduser resolves to the sandboxed HOME, missing the real file"
126124
127125 # New approach — resolves to real home via pwd
128126 import pwd
127+
129128 new_path = Path (pwd .getpwuid (os .getuid ()).pw_dir ) / ".vorta-init.json"
130- assert new_path .exists (), (
131- "pwd.getpwuid resolves to the real home where the file exists"
132- )
129+ assert new_path .exists (), "pwd.getpwuid resolves to the real home where the file exists"
133130
134131
135132# ---------------------------------------------------------------------------
136133# 2. Explicit bootstrap_file argument takes priority over pwd home
137134# ---------------------------------------------------------------------------
138135
136+
139137@skip_on_windows
140138def test_explicit_file_is_checked_first (qapp , tmp_path , mocker ):
141139 """
@@ -176,6 +174,7 @@ def test_nonexistent_explicit_file_falls_back_to_pwd_home(qapp, tmp_path, mocker
176174# 3. Default profile creation when no bootstrap file is found
177175# ---------------------------------------------------------------------------
178176
177+
179178def test_default_profile_created_when_no_bootstrap_file (qapp , tmp_path , mocker ):
180179 """
181180 When no bootstrap file exists anywhere, a 'Default' profile must be
@@ -230,6 +229,7 @@ def test_no_duplicate_default_profile(qapp, tmp_path, mocker):
230229# 4. Bootstrap file lifecycle
231230# ---------------------------------------------------------------------------
232231
232+
233233def test_bootstrap_file_deleted_after_successful_import (qapp , tmp_path , mocker ):
234234 """
235235 After a successful import the bootstrap file must be removed so it
@@ -249,9 +249,7 @@ def test_bootstrap_file_deleted_after_successful_import(qapp, tmp_path, mocker):
249249
250250 qapp .bootstrap_profile (bootstrap_file = bootstrap )
251251
252- assert not bootstrap .exists (), (
253- "Bootstrap file should be deleted after a successful import"
254- )
252+ assert not bootstrap .exists (), "Bootstrap file should be deleted after a successful import"
255253
256254
257255def test_corrupt_bootstrap_file_shows_error_dialog (qapp , tmp_path , mocker ):
@@ -289,15 +287,14 @@ def test_corrupt_bootstrap_file_is_not_deleted(qapp, tmp_path, mocker):
289287
290288 qapp .bootstrap_profile (bootstrap_file = bootstrap )
291289
292- assert bootstrap .exists (), (
293- "A corrupt bootstrap file must be preserved so the user can fix it"
294- )
290+ assert bootstrap .exists (), "A corrupt bootstrap file must be preserved so the user can fix it"
295291
296292
297293# ---------------------------------------------------------------------------
298294# 5. Docstring sanity check (catches the moved-docstring regression)
299295# ---------------------------------------------------------------------------
300296
297+
301298def test_bootstrap_profile_has_docstring ():
302299 """
303300 The docstring must be the very first statement in bootstrap_profile.
@@ -313,4 +310,4 @@ def test_bootstrap_profile_has_docstring():
313310 "bootstrap_profile has no docstring — it may have been placed "
314311 "after an executable statement, turning it into a dead expression."
315312 )
316- assert len (doc .strip ()) > 0 , "bootstrap_profile docstring must not be empty"
313+ assert len (doc .strip ()) > 0 , "bootstrap_profile docstring must not be empty"
0 commit comments