@@ -34,10 +34,17 @@ def finalizer():
34
34
request .addfinalizer (finalizer )
35
35
36
36
37
+ @pytest .fixture
38
+ def uuid () -> str :
39
+ # Get the first 8 digits part to make it shorter
40
+ uuid = uuid4 ().hex [:8 ]
41
+ return f"pytest-{ uuid } "
42
+
43
+
37
44
@pytest .fixture (scope = "module" )
38
- def bucket (storage_client : SupabaseStorageClient ) -> str :
45
+ def bucket (storage_client : SupabaseStorageClient , uuid : str ) -> str :
39
46
"""Creates a test bucket which will be used in the whole storage tests run and deleted at the end"""
40
- bucket_id = f"pytest- { uuid4 (). hex [: 8 ] } "
47
+ bucket_id = uuid
41
48
storage_client .create_bucket (id = bucket_id )
42
49
43
50
yield bucket_id
@@ -55,7 +62,7 @@ def storage_file_client(
55
62
56
63
57
64
@pytest .fixture
58
- def file (tmp_path : Path ) -> Dict [str , str ]:
65
+ def file (tmp_path : Path , uuid : str ) -> Dict [str , str ]:
59
66
"""Creates a different test file (same content but different path) for each test"""
60
67
file_name = "test_image.svg"
61
68
file_content = (
@@ -71,7 +78,7 @@ def file(tmp_path: Path) -> Dict[str, str]:
71
78
b'</linearGradient> <linearGradient id="paint1_linear" x1="36.1558" y1="30.578" x2="54.4844" y2="65.0806" '
72
79
b'gradientUnits="userSpaceOnUse"> <stop/> <stop offset="1" stop-opacity="0"/> </linearGradient> </defs> </svg>'
73
80
)
74
- bucket_folder = uuid4 (). hex [: 8 ]
81
+ bucket_folder = uuid
75
82
bucket_path = f"{ bucket_folder } /{ file_name } "
76
83
file_path = tmp_path / file_name
77
84
with open (file_path , "wb" ) as f :
0 commit comments