Repository: jonathanj/eliottree

Issue:
`iso8601.iso8601.Utc` is not reliably available
Version 0.1.12 doesn't expose this for Python 3.2.0 and newer, it looks like this is not really a public export anyway and we ought to be using `UTC` which is an instance of a UTC tzinfo implementation.

Comments:

Patch:
diff --git a/eliottree/filter.py b/eliottree/filter.py
index a3f48ea..9fd5f8f 100644
--- a/eliottree/filter.py
+++ b/eliottree/filter.py
@@ -1,7 +1,7 @@
 from datetime import datetime
 
 import jmespath
-from iso8601.iso8601 import Utc
+from iso8601.iso8601 import UTC
 
 
 def filter_by_jmespath(query):
@@ -25,7 +25,7 @@ def _parse_timestamp(timestamp):
     """
     Parse a timestamp into a UTC L{datetime}.
     """
-    return datetime.utcfromtimestamp(timestamp).replace(tzinfo=Utc())
+    return datetime.utcfromtimestamp(timestamp).replace(tzinfo=UTC)
 
 
 def filter_by_start_date(start_date):


Test patch:
diff --git a/eliottree/test/test_filter.py b/eliottree/test/test_filter.py
index 023cb02..495b4fa 100644
--- a/eliottree/test/test_filter.py
+++ b/eliottree/test/test_filter.py
@@ -1,7 +1,7 @@
 from calendar import timegm
 from datetime import datetime
 
-from iso8601.iso8601 import Utc
+from iso8601.iso8601 import UTC
 from testtools import TestCase
 from testtools.matchers import Equals
 
@@ -63,7 +63,7 @@ class FilterByStartDate(TestCase):
         Return ``False`` if the input task's timestamp is before the start
         date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 1, 0).utctimetuple()))
@@ -75,7 +75,7 @@ class FilterByStartDate(TestCase):
         """
         Return ``True`` if the input task's timestamp is after the start date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 2).utctimetuple()))
@@ -88,7 +88,7 @@ class FilterByStartDate(TestCase):
         Return ``True`` if the input task's timestamp is the same as the start
         date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 1, 15).utctimetuple()))
@@ -106,7 +106,7 @@ class FilterByEndDate(TestCase):
         Return ``False`` if the input task's timestamp is after the start
         date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 2).utctimetuple()))
@@ -119,7 +119,7 @@ class FilterByEndDate(TestCase):
         Return ``False`` if the input task's timestamp is the same as the start
         date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 1, 15).utctimetuple()))
@@ -131,7 +131,7 @@ class FilterByEndDate(TestCase):
         """
         Return ``True`` if the input task's timestamp is before the start date.
         """
-        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=Utc())
+        now = datetime(2015, 10, 30, 22, 1, 15).replace(tzinfo=UTC)
         task = dict(
             message_task,
             timestamp=timegm(datetime(2015, 10, 30, 22, 1).utctimetuple()))