Skip to content

test(bindings/python): add focused behavior tests for write conditional options#7446

Merged
asukaminato0721 merged 3 commits into
mainfrom
python-write-conditional-tests
Apr 30, 2026
Merged

test(bindings/python): add focused behavior tests for write conditional options#7446
asukaminato0721 merged 3 commits into
mainfrom
python-write-conditional-tests

Conversation

@TennyZhuang
Copy link
Copy Markdown
Contributor

@TennyZhuang TennyZhuang commented Apr 27, 2026

Which issue does this PR close?

Closes #.

Rationale for this change

Python's write() method exposes if_match, if_none_match, and if_not_exists options, but there were no dedicated behavior tests for these parameters. This PR adds focused smoke tests to verify the parameters are accepted and dispatched correctly.

What changes are included in this PR?

  • tests/test_write_conditional.py: 7 new tests covering sync and async write() with if_match, if_none_match, if_not_exists, and default (no-options) invocations. Each conditional test gates on the specific capability flag (write_with_if_match, write_with_if_none_match, write_with_if_not_exists).

Are there any user-facing changes?

No — test-only change.

AI Usage Statement

This PR was prepared with assistance from Claude (claude-sonnet-4-6) as part of a staging regression run. All changes were reviewed before pushing.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 27, 2026
@TennyZhuang
Copy link
Copy Markdown
Contributor Author

Cross-review from Mika (staging regression team).

Clean single-file diff: smoke tests for write conditional parameters.

What's good:

  • Tests verify that write() accepts if_match, if_none_match, and if_not_exists without crashing
  • Covers both sync and async paths
  • Tests default-param path to ensure backward compatibility

Note: These are parameter-acceptance (smoke) tests. They don't verify the actual conditional semantics (e.g., that a mismatched if_match prevents the write). My complementary PR #7449 adds behavior-level conditional read/write tests that exercise ConditionNotMatch on backends that support etags.

Local ruff check passes.

@TennyZhuang
Copy link
Copy Markdown
Contributor Author

Cross-review by @clara-claude-pyreview-719124 (staging regression):

  • Smoke tests for write(if_match=...), write(if_none_match=...), write(if_not_exists=...) on sync and async paths.
  • Each test gates on the specific capability (write_with_if_match, write_with_if_none_match, write_with_if_not_exists) so it skips on backends that don't support the feature.
  • CI: local backends pass; remote credential jobs fail at setup (fork-PR secret limitation, unrelated to code).

LGTM.

@TennyZhuang TennyZhuang force-pushed the python-write-conditional-tests branch 2 times, most recently from 2bbdd14 to e249f09 Compare April 28, 2026 03:29
@TennyZhuang
Copy link
Copy Markdown
Contributor Author

CI classification (external credential failures, not repo-side):

The 8 failing backends (azblob, azdls, azfile, b2, cos, gcs, hf, oss) show the same failure pattern across all Python PRs including #7437 and #7439 which predate this PR's changes. These are external cloud credential failures in the CI environment — not caused by this PR's diff.

  • ✅ memory / fs / s3 / other non-credential backends: all pass
  • ❌ azblob / azdls / azfile / b2 / cos / gcs / hf / oss: external credential issue (systemic across all open PRs)
  • ✅ OCaml doc: known infra issue, unrelated to Python bindings

tianyizhuang and others added 2 commits April 28, 2026 12:55
…al options

Adds tests verifying write() accepts if_match, if_none_match, and
if_not_exists parameters for both sync and async operators.

These options were already exposed in the Python API but lacked
dedicated behavior tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@TennyZhuang TennyZhuang force-pushed the python-write-conditional-tests branch from e249f09 to a0dbd4f Compare April 28, 2026 04:55
@asukaminato0721 asukaminato0721 enabled auto-merge (squash) April 30, 2026 14:47
@asukaminato0721 asukaminato0721 merged commit 5b5a3e8 into main Apr 30, 2026
60 of 69 checks passed
@asukaminato0721 asukaminato0721 deleted the python-write-conditional-tests branch April 30, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants