66import os
77import time
88from .memo_test_types import MemoTestClass , MemoTestSingleton
9- from .conftest import DB0_DIR
9+ from .conftest import DB0_DIR , worker_path
1010import multiprocessing
1111
1212
1313def test_copy_current_prefix (db0_fixture ):
14- file_name = "./test-copy.db0"
14+ file_name = worker_path ( "./test-copy.db0" )
1515 # remove file if it exists
1616 if os .path .exists (file_name ):
1717 os .remove (file_name )
@@ -30,7 +30,7 @@ def test_copy_current_prefix(db0_fixture):
3030
3131
3232def test_recover_prefix_from_copy (db0_fixture ):
33- file_name = "./test-copy.db0"
33+ file_name = worker_path ( "./test-copy.db0" )
3434 # remove file if it exists
3535 if os .path .exists (file_name ):
3636 os .remove (file_name )
@@ -58,7 +58,7 @@ def test_recover_prefix_from_copy(db0_fixture):
5858
5959
6060def test_copy_prefix_custom_step_size (db0_fixture ):
61- file_name = "./test-copy.db0"
61+ file_name = worker_path ( "./test-copy.db0" )
6262 if os .path .exists (file_name ):
6363 os .remove (file_name )
6464
@@ -110,7 +110,7 @@ def writer_process(prefix, obj_count = 50, commit_count = 50, long_run = False):
110110
111111
112112def test_copy_prefix_being_actively_modified (db0_fixture ):
113- file_name = "./test-copy.db0"
113+ file_name = worker_path ( "./test-copy.db0" )
114114 if os .path .exists (file_name ):
115115 os .remove (file_name )
116116
@@ -153,7 +153,7 @@ def test_copy_prefix_being_actively_modified(db0_fixture):
153153
154154
155155def test_copy_prefix_fails_if_no_active_prefix (db0_fixture ):
156- file_name = "./test-copy.db0"
156+ file_name = worker_path ( "./test-copy.db0" )
157157 # remove file if it exists
158158 if os .path .exists (file_name ):
159159 os .remove (file_name )
@@ -172,7 +172,7 @@ def test_copy_prefix_fails_if_no_active_prefix(db0_fixture):
172172
173173
174174def test_copy_prefix_without_opening_it (db0_fixture ):
175- file_name = "./test-copy.db0"
175+ file_name = worker_path ( "./test-copy.db0" )
176176 # remove file if it exists
177177 if os .path .exists (file_name ):
178178 os .remove (file_name )
@@ -207,7 +207,7 @@ def validate_current_prefix(expected_len = None, expected_min_len = None):
207207 return len (root .value )
208208
209209 def validate_copy (copy_id , expected_len = None , expected_min_len = None ):
210- file_name = f"./test-copy-{ copy_id } .db0"
210+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
211211 os .remove (px_path )
212212 # restore the copy
213213 os .rename (file_name , px_path )
@@ -250,7 +250,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
250250 while True :
251251 if not p .is_alive ():
252252 break
253- file_name = f"./test-copy-{ copy_id } .db0"
253+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
254254 if os .path .exists (file_name ):
255255 os .remove (file_name )
256256 # copy prefix without opening it, use default step size
@@ -266,7 +266,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
266266 total_len += obj_count * commit_count
267267
268268 # make final stale copy (i.e. without active modifications)
269- final_copy = f "./test-copy-final.db0"
269+ final_copy = worker_path ( "./test-copy-final.db0" )
270270 if os .path .exists (final_copy ):
271271 os .remove (final_copy )
272272 db0 .copy_prefix (final_copy , prefix = px_name )
@@ -284,7 +284,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
284284
285285
286286def test_modify_copied_prefix (db0_fixture ):
287- file_name = "./test-copy.db0"
287+ file_name = worker_path ( "./test-copy.db0" )
288288 # remove file if it exists
289289 if os .path .exists (file_name ):
290290 os .remove (file_name )
@@ -326,7 +326,7 @@ def modify_prefix():
326326
327327@pytest .mark .parametrize ("db0_fixture" , [{"autocommit" : False }], indirect = True )
328328def test_copy_prefix_of_recovered_copy (db0_fixture ):
329- file_name = "./test-copy.db0"
329+ file_name = worker_path ( "./test-copy.db0" )
330330 # remove file if it exists
331331 if os .path .exists (file_name ):
332332 os .remove (file_name )
@@ -398,7 +398,7 @@ def validate_current_prefix(expected_len = None, expected_min_len = None):
398398 return len (root .value )
399399
400400 def validate_copy (copy_id , expected_len = None , expected_min_len = None ):
401- file_name = f"./test-copy-{ copy_id } .db0"
401+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
402402 os .remove (px_path )
403403 # restore the copy
404404 os .rename (file_name , px_path )
@@ -437,7 +437,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
437437 while True :
438438 if not p .is_alive ():
439439 break
440- file_name = f"./test-copy-{ copy_id } .db0"
440+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
441441 if os .path .exists (file_name ):
442442 os .remove (file_name )
443443 db0 .copy_prefix (file_name , prefix = px_name )
@@ -468,7 +468,7 @@ def validate_current_prefix(expected_len = None, expected_min_len = None):
468468 return len (root .value )
469469
470470 def validate_copy (copy_id , expected_len = None , expected_min_len = None ):
471- file_name = f"./test-copy-{ copy_id } .db0"
471+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
472472 os .remove (px_path )
473473 # restore the copy
474474 os .rename (file_name , px_path )
@@ -513,7 +513,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
513513 while True :
514514 if not p .is_alive ():
515515 break
516- file_name = f"./test-copy-{ copy_id } .db0"
516+ file_name = worker_path ( f"./test-copy-{ copy_id } .db0" )
517517 if os .path .exists (file_name ):
518518 os .remove (file_name )
519519 # copy prefix without opening it, use default step size
@@ -529,7 +529,7 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
529529 total_len += obj_count * commit_count
530530
531531 # make final stale copy (i.e. without active modifications)
532- final_copy = f "./test-copy-final.db0"
532+ final_copy = worker_path ( "./test-copy-final.db0" )
533533 if os .path .exists (final_copy ):
534534 os .remove (final_copy )
535535 db0 .copy_prefix (final_copy , prefix = px_name )
@@ -543,4 +543,4 @@ def validate_copy(copy_id, expected_len = None, expected_min_len = None):
543543 # this is the restored version
544544 total_len = last_len
545545
546-
546+
0 commit comments