Skip to content

Commit ee02547

Browse files
authored
Merge pull request Backblaze#1060 from Backblaze/fix-win-integr-test
Fix test_sync_up for windows
2 parents f0b58cb + dece212 commit ee02547

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update to b2sdk 2.7.0 to fix integration tests on Windows.

pdm.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
dependencies = [
2626
"argcomplete>=3.5.2,<4",
2727
"arrow>=1.0.2,<2.0.0",
28-
"b2sdk>=2.6.0,<3",
28+
"b2sdk>=2.7.0,<3",
2929
"docutils>=0.18.1",
3030
"idna~=3.4; platform_system == 'Java'",
3131
"importlib-metadata>=3.3; python_version < '3.8'",

test/integration/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,14 @@ def auto_change_account_info_dir(monkeysession) -> str:
226226
monkeysession.delenv('B2_APPLICATION_KEY_ID', raising=False)
227227
monkeysession.delenv('B2_APPLICATION_KEY', raising=False)
228228

229+
# Ignore occasional PermissionError on Windows
230+
if sys.platform == 'win32' and (sys.version_info.major, sys.version_info.minor) > (3, 9):
231+
kwargs = dict(ignore_cleanup_errors=True)
232+
else:
233+
kwargs = {}
234+
229235
# make b2sdk use temp dir for storing default & per-profile account information
230-
with TemporaryDirectory() as temp_dir:
236+
with TemporaryDirectory(**kwargs) as temp_dir:
231237
monkeysession.setenv(B2_ACCOUNT_INFO_ENV_VAR, path.join(temp_dir, '.b2_account_info'))
232238
monkeysession.setenv(XDG_CONFIG_HOME_ENV_VAR, temp_dir)
233239
yield temp_dir

test/integration/test_b2_command_line.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,10 +3429,8 @@ def test_notification_rules(b2_tool, bucket_name):
34293429
if 'writeBucketNotifications' not in auth_dict['allowed']['capabilities']:
34303430
pytest.skip('Test account does not have writeBucketNotifications capability')
34313431

3432-
private_preview_pattern = re.compile(r'FeaturePreviewWarning')
34333432
assert b2_tool.should_succeed_json(
3434-
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
3435-
expected_stderr_pattern=private_preview_pattern
3433+
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
34363434
) == []
34373435

34383436
notification_rule = {
@@ -3461,8 +3459,7 @@ def test_notification_rules(b2_tool, bucket_name):
34613459
"https://example.com/webhook",
34623460
"--event-type",
34633461
"b2:ObjectCreated:*",
3464-
],
3465-
expected_stderr_pattern=private_preview_pattern
3462+
]
34663463
)
34673464
expected_rules = [{**notification_rule, "isSuspended": False, "suspensionReason": ""}]
34683465
assert_dict_equal_ignore_extra(created_rule, expected_rules[0])
@@ -3480,8 +3477,7 @@ def test_notification_rules(b2_tool, bucket_name):
34803477
"--disable",
34813478
"--sign-secret",
34823479
secret,
3483-
],
3484-
expected_stderr_pattern=private_preview_pattern
3480+
]
34853481
)
34863482
expected_rules[0].update({"objectNamePrefix": "prefix", "isEnabled": False})
34873483
expected_rules[0]["targetConfiguration"]["hmacSha256SigningSecret"] = secret
@@ -3490,18 +3486,15 @@ def test_notification_rules(b2_tool, bucket_name):
34903486
# read updated rules
34913487
assert_dict_equal_ignore_extra(
34923488
b2_tool.should_succeed_json(
3493-
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
3494-
expected_stderr_pattern=private_preview_pattern
3489+
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
34953490
),
34963491
expected_rules,
34973492
)
34983493

34993494
# delete rule by name
35003495
assert b2_tool.should_succeed(
3501-
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"],
3502-
expected_stderr_pattern=private_preview_pattern
3496+
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"]
35033497
) == f"Rule 'test-rule' has been deleted from b2://{bucket_name}/\n"
35043498
assert b2_tool.should_succeed_json(
3505-
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
3506-
expected_stderr_pattern=private_preview_pattern
3499+
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
35073500
) == []

0 commit comments

Comments
 (0)