atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[Bitbucket] Robust datetime parsing for commit dates (#1589)

Open PR-HARIHARAN opened this issue 2 months ago • 1 comments

This PR fixes a datetime parsing issue when reading Bitbucket Cloud commit dates that include both an explicit timezone and a trailing 'Z', e.g.

2025-09-18T21:26:38+00:00Z

Such values previously caused a ValueError when accessed via Commit.date.

Related issue: #1589

Files changed

  • Modified: atlassian/bitbucket/base.py

    • Improve get_time() to normalize timestamps that contain a timezone followed by an extraneous trailing Z, handle Python <3.7 %z colon differences, and attempt multiple sensible datetime formats before falling back.
  • Added: tests/test_bug_reproduction.py

    • Unit reproduction test that asserts a Commit built with "2025-09-18T21:26:38+00:00Z" returns a parsed value via .date.

PR-HARIHARAN avatar Oct 06 '25 05:10 PR-HARIHARAN

Codecov Report

:x: Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 41.97%. Comparing base (f5c0afa) to head (a218359). :warning: Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
atlassian/bitbucket/base.py 66.66% 1 Missing and 3 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1591      +/-   ##
==========================================
- Coverage   42.24%   41.97%   -0.28%     
==========================================
  Files          66       66              
  Lines        8588     8541      -47     
  Branches     1036     1041       +5     
==========================================
- Hits         3628     3585      -43     
- Misses       4820     4821       +1     
+ Partials      140      135       -5     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Oct 06 '25 06:10 codecov[bot]