Skip to content

Conversation

PR-HARIHARAN
Copy link

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.

)

Normalize timestamps like 'YYYY-MM-DDTHH:MM:SS+00:00Z', handle Python <3.7 %z format, and try multiple datetime formats.
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.97%. Comparing base (f5c0afa) to head (a218359).
⚠️ 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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@PR-HARIHARAN PR-HARIHARAN force-pushed the fix/bitbucket-datetime-1589 branch from a218359 to cfbc483 Compare October 6, 2025 06:24
)

Normalize timestamps like 'YYYY-MM-DDTHH:MM:SS+00:00Z', handle Python <3.7 %z format, and try multiple datetime formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant