@@ -255,22 +255,24 @@ mod tests {
255
255
#[ sqlx:: test]
256
256
async fn test_task_cache_initialization ( ) {
257
257
let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
258
- std:: env:: set_var ( "DEVENV_DOTFILE" , temp_dir. path ( ) . to_str ( ) . unwrap ( ) ) ;
258
+ let db_path = temp_dir. path ( ) . join ( "tasks.db" ) ;
259
+
260
+ // Use with_db_path directly instead of environment variable
261
+ let cache = TaskCache :: with_db_path ( db_path) . await . unwrap ( ) ;
259
262
260
- let cache = TaskCache :: new ( ) . await . unwrap ( ) ;
261
263
// Check if the database connection is valid using a simple query
262
264
let result = sqlx:: query ( "SELECT 1" ) . fetch_one ( cache. db . pool ( ) ) . await ;
263
265
assert ! ( result. is_ok( ) ) ;
264
266
}
265
267
266
268
#[ sqlx:: test]
267
269
async fn test_file_modification_detection ( ) {
268
- let dotfile_dir = TempDir :: new ( ) . unwrap ( ) ;
269
- std :: env :: set_var ( "DEVENV_DOTFILE" , dotfile_dir . path ( ) . to_str ( ) . unwrap ( ) ) ;
270
+ let db_temp_dir = TempDir :: new ( ) . unwrap ( ) ;
271
+ let db_path = db_temp_dir . path ( ) . join ( "tasks-file-mod.db" ) ;
270
272
271
- let cache = TaskCache :: new ( ) . await . unwrap ( ) ;
272
- let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
273
- let file_path = temp_dir . path ( ) . join ( "test.txt" ) ;
273
+ let cache = TaskCache :: with_db_path ( db_path ) . await . unwrap ( ) ;
274
+ let test_temp_dir = TempDir :: new ( ) . unwrap ( ) ;
275
+ let file_path = test_temp_dir . path ( ) . join ( "test.txt" ) ;
274
276
275
277
// Create a test file
276
278
{
@@ -338,12 +340,12 @@ mod tests {
338
340
339
341
#[ sqlx:: test]
340
342
async fn test_directory_modification_detection ( ) {
341
- let dotfile_dir = TempDir :: new ( ) . unwrap ( ) ;
342
- std :: env :: set_var ( "DEVENV_DOTFILE" , dotfile_dir . path ( ) . to_str ( ) . unwrap ( ) ) ;
343
+ let db_temp_dir = TempDir :: new ( ) . unwrap ( ) ;
344
+ let db_path = db_temp_dir . path ( ) . join ( "tasks-dir-mod.db" ) ;
343
345
344
- let cache = TaskCache :: new ( ) . await . unwrap ( ) ;
345
- let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
346
- let dir_path = temp_dir . path ( ) . join ( "test_dir" ) ;
346
+ let cache = TaskCache :: with_db_path ( db_path ) . await . unwrap ( ) ;
347
+ let test_temp_dir = TempDir :: new ( ) . unwrap ( ) ;
348
+ let dir_path = test_temp_dir . path ( ) . join ( "test_dir" ) ;
347
349
std:: fs:: create_dir ( & dir_path) . unwrap ( ) ;
348
350
349
351
let task_name = "test_task_dir" ;
0 commit comments