File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -70,18 +70,27 @@ class MockSettings:
7070 # Replace the settings import
7171 monkeypatch .setattr ("memos.mem_user.user_manager.settings" , MockSettings ())
7272
73+ manager = None
7374 try :
7475 manager = UserManager ()
7576 expected_path = mock_memos_dir / "memos_users.db"
7677 assert manager .db_path == str (expected_path )
7778 assert os .path .exists (expected_path )
7879 finally :
80+ # Close database connections first
81+ if manager :
82+ manager .close ()
83+
7984 # Cleanup
80- expected_path = mock_memos_dir / "memos_users.db"
81- if os .path .exists (expected_path ):
82- os .remove (expected_path )
83- if os .path .exists (temp_dir ):
84- os .rmdir (temp_dir )
85+ try :
86+ expected_path = mock_memos_dir / "memos_users.db"
87+ if os .path .exists (expected_path ):
88+ os .remove (expected_path )
89+ if os .path .exists (temp_dir ):
90+ os .rmdir (temp_dir )
91+ except (OSError , PermissionError ):
92+ # On Windows, files might still be locked, ignore cleanup errors
93+ pass
8594
8695
8796class TestUserOperations :
You can’t perform that action at this time.
0 commit comments