← Back to team overview

ubuntu-bugcontrol team mailing list archive

[Merge] ~hlibk/ubuntu-qa-tools:unembargo-warning into ubuntu-qa-tools:master

 

Hlib Korzhynskyy has proposed merging ~hlibk/ubuntu-qa-tools:unembargo-warning into ubuntu-qa-tools:master.

Requested reviews:
  Ubuntu Bug Control (ubuntu-bugcontrol)

For more details, see:
https://code.launchpad.net/~hlibk/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/477994

When running the unembargo script, a DeprecationWarning appears:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

This change removes the warning.
-- 
Your team Ubuntu Bug Control is requested to review the proposed merge of ~hlibk/ubuntu-qa-tools:unembargo-warning into ubuntu-qa-tools:master.
diff --git a/security-tools/unembargo b/security-tools/unembargo
index 5b5d357..221bf38 100755
--- a/security-tools/unembargo
+++ b/security-tools/unembargo
@@ -132,7 +132,7 @@ def pending_milestone(ubuntu, release):
     MILESTONE_WINDOW = 7
 
     milestone = None
-    now = datetime.datetime.utcnow()
+    now = datetime.datetime.now(datetime.UTC).replace(tzinfo=None)
     series = ubuntu.getSeries(name_or_version=release)
 
     for _milestone in series.all_milestones:

Follow ups