Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from Backblaze:master #311

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+fix_autocomplete.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix shell autocompletion for Python >=3.12.8 and >=3.13.1.
1 change: 1 addition & 0 deletions changelog.d/+fix_test_sync_for_win.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update to b2sdk 2.7.0 to fix integration tests on Windows.
20 changes: 10 additions & 10 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -23,9 +23,9 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
dependencies = [
"argcomplete>=2,<4",
"argcomplete>=3.5.2,<4",
"arrow>=1.0.2,<2.0.0",
"b2sdk>=2.6.0,<3",
"b2sdk>=2.7.0,<3",
"docutils>=0.18.1",
"idna~=3.4; platform_system == 'Java'",
"importlib-metadata>=3.3; python_version < '3.8'",
@@ -200,7 +200,7 @@ release = [
]
test = [
"coverage==7.2.7",
"pexpect==4.8.0",
"pexpect==4.9.0",
"pytest==8.3.3",
"pytest-cov==3.0.0",
"pytest-forked==1.6.0",
8 changes: 7 additions & 1 deletion test/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -226,8 +226,14 @@ def auto_change_account_info_dir(monkeysession) -> str:
monkeysession.delenv('B2_APPLICATION_KEY_ID', raising=False)
monkeysession.delenv('B2_APPLICATION_KEY', raising=False)

# Ignore occasional PermissionError on Windows
if sys.platform == 'win32' and (sys.version_info.major, sys.version_info.minor) > (3, 9):
kwargs = dict(ignore_cleanup_errors=True)
else:
kwargs = {}

# make b2sdk use temp dir for storing default & per-profile account information
with TemporaryDirectory() as temp_dir:
with TemporaryDirectory(**kwargs) as temp_dir:
monkeysession.setenv(B2_ACCOUNT_INFO_ENV_VAR, path.join(temp_dir, '.b2_account_info'))
monkeysession.setenv(XDG_CONFIG_HOME_ENV_VAR, temp_dir)
yield temp_dir
19 changes: 6 additions & 13 deletions test/integration/test_b2_command_line.py
Original file line number Diff line number Diff line change
@@ -3429,10 +3429,8 @@ def test_notification_rules(b2_tool, bucket_name):
if 'writeBucketNotifications' not in auth_dict['allowed']['capabilities']:
pytest.skip('Test account does not have writeBucketNotifications capability')

private_preview_pattern = re.compile(r'FeaturePreviewWarning')
assert b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
) == []

notification_rule = {
@@ -3461,8 +3459,7 @@ def test_notification_rules(b2_tool, bucket_name):
"https://example.com/webhook",
"--event-type",
"b2:ObjectCreated:*",
],
expected_stderr_pattern=private_preview_pattern
]
)
expected_rules = [{**notification_rule, "isSuspended": False, "suspensionReason": ""}]
assert_dict_equal_ignore_extra(created_rule, expected_rules[0])
@@ -3480,8 +3477,7 @@ def test_notification_rules(b2_tool, bucket_name):
"--disable",
"--sign-secret",
secret,
],
expected_stderr_pattern=private_preview_pattern
]
)
expected_rules[0].update({"objectNamePrefix": "prefix", "isEnabled": False})
expected_rules[0]["targetConfiguration"]["hmacSha256SigningSecret"] = secret
@@ -3490,18 +3486,15 @@ def test_notification_rules(b2_tool, bucket_name):
# read updated rules
assert_dict_equal_ignore_extra(
b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
),
expected_rules,
)

# delete rule by name
assert b2_tool.should_succeed(
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "delete", f"b2://{bucket_name}", "test-rule"]
) == f"Rule 'test-rule' has been deleted from b2://{bucket_name}/\n"
assert b2_tool.should_succeed_json(
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"],
expected_stderr_pattern=private_preview_pattern
["bucket", "notification-rule", "list", f"b2://{bucket_name}", "--json"]
) == []