Skip to content

fix(timezone): Make datetime usage timezone-aware for DTZ lint rules - #8355

Draft
jenshnielsen wants to merge 1 commit into
microsoft:mainfrom
jenshnielsen:ruff_016_timezone
Draft

fix(timezone): Make datetime usage timezone-aware for DTZ lint rules#8355
jenshnielsen wants to merge 1 commit into
microsoft:mainfrom
jenshnielsen:ruff_016_timezone

Conversation

@jenshnielsen

Copy link
Copy Markdown
Collaborator
  • Use datetime.now(timezone.utc).astimezone() for local time with UTC offset
  • Update all datetime.fromtimestamp() calls with tz parameter
  • Store parameter cache timestamps as timezone-aware local time
  • Parameter snapshot 'ts' field now includes UTC offset (e.g. '2024-01-01 13:00:00+01:00')
  • Fix buggy manual timezone computation in AWG70000A driver
  • Update all test files to use timezone-aware datetimes
  • Update snapshot parsing to use fromisoformat() for ISO 8601 format

Fixes DTZ005, DTZ006, DTZ007 ruff lint violations. Existing datasets remain unaffected; only new ones have explicit timezone info.

- Use datetime.now(timezone.utc).astimezone() for local time with UTC offset
- Update all datetime.fromtimestamp() calls with tz parameter
- Store parameter cache timestamps as timezone-aware local time
- Parameter snapshot 'ts' field now includes UTC offset (e.g. '2024-01-01 13:00:00+01:00')
- Fix buggy manual timezone computation in AWG70000A driver
- Update all test files to use timezone-aware datetimes
- Update snapshot parsing to use fromisoformat() for ISO 8601 format

Fixes DTZ005, DTZ006, DTZ007 ruff lint violations.
Existing datasets remain unaffected; only new ones have explicit timezone info.
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.09%. Comparing base (a997230) to head (adcc887).

Files with missing lines Patch % Lines
...rc/qcodes/instrument_drivers/Keysight/Infiniium.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8355   +/-   ##
=======================================
  Coverage   71.09%   71.09%           
=======================================
  Files         305      305           
  Lines       31913    31901   -12     
=======================================
- Hits        22687    22679    -8     
+ Misses       9226     9222    -4     

☔ View full report in Codecov by Harness.
📢 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.

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