11######################################################################
22#
3- # File: test/integration /bucket_manager.py
3+ # File: b2sdk/_internal/testing/helpers /bucket_manager.py
44#
55# Copyright 2022 Backblaze Inc. All Rights Reserved.
66#
1313import platform
1414from collections .abc import Iterable
1515from datetime import datetime , timedelta
16-
1716from itertools import chain
1817from typing import Any
1918
2019import tenacity
2120
22- from b2sdk ._internal .exception import BucketIdNotFound , TooManyRequests , FileNotPresent
21+ from b2sdk ._internal .exception import BucketIdNotFound , FileNotPresent , TooManyRequests
22+ from b2sdk ._internal .testing .helpers .buckets import (
23+ BUCKET_CREATED_AT_MILLIS ,
24+ BUCKET_NAME_LENGTH ,
25+ GENERAL_BUCKET_NAME_PREFIX ,
26+ random_token ,
27+ )
2328from b2sdk .v3 import (
2429 NO_RETENTION_FILE_SETTING ,
2530 B2Api ,
2934 current_time_millis ,
3035)
3136from b2sdk .v3 .exception import BadRequest
32- from b2sdk ._internal .testing .helpers .buckets import BUCKET_CREATED_AT_MILLIS , GENERAL_BUCKET_NAME_PREFIX , random_token , \
33- BUCKET_NAME_LENGTH
34-
3537
3638NODE_DESCRIPTION = f'{ platform .node ()} : { platform .platform ()} '
3739ONE_HOUR_MILLIS = 60 * 60 * 1000
@@ -45,8 +47,8 @@ def __init__(
4547 self ,
4648 dont_cleanup_old_buckets : bool ,
4749 b2_api : B2Api ,
48- current_run_prefix : str ,
49- general_prefix : str = GENERAL_BUCKET_NAME_PREFIX
50+ current_run_prefix : str = '' ,
51+ general_prefix : str = GENERAL_BUCKET_NAME_PREFIX ,
5052 ):
5153 self .current_run_prefix = current_run_prefix
5254 self .general_prefix = general_prefix
@@ -77,7 +79,7 @@ def create_bucket(self, bucket_type: str = 'allPublic', **kwargs) -> Bucket:
7779 )
7880
7981 def _should_remove_bucket (self , bucket : Bucket ) -> tuple [bool , str ]:
80- if bucket .name .startswith (self .current_run_prefix ):
82+ if self . current_run_prefix and bucket .name .startswith (self .current_run_prefix ):
8183 return True , 'it is a bucket for this very run'
8284 if self .dont_cleanup_old_buckets :
8385 return False , 'old buckets ought not to be cleaned'
0 commit comments