summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@jelmer.uk>2023-01-28 16:55:56 +0000
committerJelmer Vernooij <jelmer@jelmer.uk>2023-02-10 17:47:03 +0000
commit496a0a483dd8629deaf7821c739b2b83c8e7d3d6 (patch)
treefc829e4d55d66082e48c0dcb0389b9f7efe377db
parente40507dfb292de805fcbd125594579c40e5165a8 (diff)
downloadsubunit-git-external-iso8601.tar.gz
Rely on external copy of iso8601external-iso8601
-rw-r--r--COPYING2
-rw-r--r--Makefile.am6
-rw-r--r--NEWS5
-rw-r--r--README.rst3
-rw-r--r--python/iso8601/LICENSE20
-rw-r--r--python/iso8601/README26
-rw-r--r--python/iso8601/README.subunit5
-rw-r--r--python/iso8601/setup.py58
-rw-r--r--python/iso8601/test_iso8601.py112
-rw-r--r--python/subunit/__init__.py7
-rw-r--r--python/subunit/_output.py2
-rw-r--r--python/subunit/iso8601.py128
-rw-r--r--python/subunit/test_results.py3
-rw-r--r--python/subunit/tests/test_output_filter.py3
-rw-r--r--python/subunit/tests/test_subunit_filter.py5
-rw-r--r--python/subunit/tests/test_test_protocol.py7
-rw-r--r--python/subunit/tests/test_test_protocol2.py6
-rw-r--r--python/subunit/tests/test_test_results.py6
-rw-r--r--python/subunit/v2.py4
-rwxr-xr-xsetup.py1
20 files changed, 29 insertions, 380 deletions
diff --git a/COPYING b/COPYING
index 452c080..fc6b993 100644
--- a/COPYING
+++ b/COPYING
@@ -29,8 +29,6 @@ Code that has been incorporated into Subunit from other projects will
naturally be under its own license, and will retain that license.
A known list of such code is maintained here:
-* The python/iso8601 module by Michael Twomey, distributed under an MIT style
- licence - see python/iso8601/LICENSE for details.
* The runtests.py and python/subunit/tests/TestUtil.py module are GPL test
support modules. They are not installed by Subunit - they are only ever
used on the build machine. Copyright 2004 Canonical Limited.
diff --git a/Makefile.am b/Makefile.am
index 5d68c98..d677c49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,11 +12,6 @@ EXTRA_DIST = \
c/check-subunit-0.9.3.patch \
c/check-subunit-0.9.5.patch \
c/check-subunit-0.9.6.patch \
- python/iso8601/LICENSE \
- python/iso8601/README \
- python/iso8601/README.subunit \
- python/iso8601/setup.py \
- python/iso8601/test_iso8601.py \
python/subunit/tests/__init__.py \
python/subunit/tests/sample-script.py \
python/subunit/tests/sample-two-script.py \
@@ -73,7 +68,6 @@ pkgpython_PYTHON = \
python/subunit/chunked.py \
python/subunit/details.py \
python/subunit/filters.py \
- python/subunit/iso8601.py \
python/subunit/progress_model.py \
python/subunit/run.py \
python/subunit/v2.py \
diff --git a/NEWS b/NEWS
index 8c6444e..8cdd791 100644
--- a/NEWS
+++ b/NEWS
@@ -5,12 +5,15 @@ subunit release notes
NEXT (In development)
---------------------
-* Drop various compatibility wrappers for Python < 3.6.
+* Subunit now has a dependency on an external iso8601
+ module rather than shipping its own.
(Jelmer Vernooij)
IMPROVEMENTS
~~~~~~~~~~~~
+* Drop various compatibility wrappers for Python < 3.6.
+
BUG FIXES
~~~~~~~~~
diff --git a/README.rst b/README.rst
index 86660aa..8b4c1a2 100644
--- a/README.rst
+++ b/README.rst
@@ -15,9 +15,6 @@
See the COPYING file for full details on the licensing of Subunit.
- subunit reuses iso8601 by Michael Twomey, distributed under an MIT style
- licence - see python/iso8601/LICENSE for details.
-
Subunit
-------
diff --git a/python/iso8601/LICENSE b/python/iso8601/LICENSE
deleted file mode 100644
index 5ca93da..0000000
--- a/python/iso8601/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2007 Michael Twomey
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/python/iso8601/README b/python/iso8601/README
deleted file mode 100644
index 5ec9d45..0000000
--- a/python/iso8601/README
+++ /dev/null
@@ -1,26 +0,0 @@
-A simple package to deal with ISO 8601 date time formats.
-
-ISO 8601 defines a neutral, unambiguous date string format, which also
-has the property of sorting naturally.
-
-e.g. YYYY-MM-DDTHH:MM:SSZ or 2007-01-25T12:00:00Z
-
-Currently this covers only the most common date formats encountered, not
-all of ISO 8601 is handled.
-
-Currently the following formats are handled:
-
-* 2006-01-01T00:00:00Z
-* 2006-01-01T00:00:00[+-]00:00
-
-I'll add more as I encounter them in my day to day life. Patches with
-new formats and tests will be gratefully accepted of course :)
-
-References:
-
-* http://www.cl.cam.ac.uk/~mgk25/iso-time.html - simple overview
-
-* http://hydracen.com/dx/iso8601.htm - more detailed enumeration of
- valid formats.
-
-See the LICENSE file for the license this package is released under.
diff --git a/python/iso8601/README.subunit b/python/iso8601/README.subunit
deleted file mode 100644
index d1ed8a1..0000000
--- a/python/iso8601/README.subunit
+++ /dev/null
@@ -1,5 +0,0 @@
-This is a [slightly rearranged] import of http://pypi.python.org/pypi/iso8601/
-version 0.1.4. The OS X hidden files have been stripped, and the package
-turned into a single module, to simplify installation. The remainder of the
-source distribution is included in the subunit source tree at python/iso8601
-for reference.
diff --git a/python/iso8601/setup.py b/python/iso8601/setup.py
deleted file mode 100644
index cdb61ec..0000000
--- a/python/iso8601/setup.py
+++ /dev/null
@@ -1,58 +0,0 @@
-try:
- from setuptools import setup
-except ImportError:
- from distutils import setup
-
-long_description="""Simple module to parse ISO 8601 dates
-
-This module parses the most common forms of ISO 8601 date strings (e.g.
-2007-01-14T20:34:22+00:00) into datetime objects.
-
->>> import iso8601
->>> iso8601.parse_date("2007-01-25T12:00:00Z")
-datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)
->>>
-
-Changes
-=======
-
-0.1.4
------
-
-* The default_timezone argument wasn't being passed through correctly,
- UTC was being used in every case. Fixes issue 10.
-
-0.1.3
------
-
-* Fixed the microsecond handling, the generated microsecond values were
- way too small. Fixes issue 9.
-
-0.1.2
------
-
-* Adding ParseError to __all__ in iso8601 module, allows people to import it.
- Addresses issue 7.
-* Be a little more flexible when dealing with dates without leading zeroes.
- This violates the spec a little, but handles more dates as seen in the
- field. Addresses issue 6.
-* Allow date/time separators other than T.
-
-0.1.1
------
-
-* When parsing dates without a timezone the specified default is used. If no
- default is specified then UTC is used. Addresses issue 4.
-"""
-
-setup(
- name="iso8601",
- version="0.1.4",
- description=long_description.split("\n")[0],
- long_description=long_description,
- author="Michael Twomey",
- author_email="micktwomey+iso8601@gmail.com",
- url="http://code.google.com/p/pyiso8601/",
- packages=["iso8601"],
- license="MIT",
-)
diff --git a/python/iso8601/test_iso8601.py b/python/iso8601/test_iso8601.py
deleted file mode 100644
index ae6741e..0000000
--- a/python/iso8601/test_iso8601.py
+++ /dev/null
@@ -1,112 +0,0 @@
-import iso8601
-
-
-def test_iso8601_regex():
- assert iso8601.ISO8601_REGEX.match("2006-10-11T00:14:33Z")
-
-def test_timezone_regex():
- assert iso8601.TIMEZONE_REGEX.match("+01:00")
- assert iso8601.TIMEZONE_REGEX.match("+00:00")
- assert iso8601.TIMEZONE_REGEX.match("+01:20")
- assert iso8601.TIMEZONE_REGEX.match("-01:00")
-
-def test_parse_date():
- d = iso8601.parse_date("2006-10-20T15:34:56Z")
- assert d.year == 2006
- assert d.month == 10
- assert d.day == 20
- assert d.hour == 15
- assert d.minute == 34
- assert d.second == 56
- assert d.tzinfo == iso8601.UTC
-
-def test_parse_date_fraction():
- d = iso8601.parse_date("2006-10-20T15:34:56.123Z")
- assert d.year == 2006
- assert d.month == 10
- assert d.day == 20
- assert d.hour == 15
- assert d.minute == 34
- assert d.second == 56
- assert d.microsecond == 123000
- assert d.tzinfo == iso8601.UTC
-
-def test_parse_date_fraction_2():
- """From bug 6
-
- """
- d = iso8601.parse_date("2007-5-7T11:43:55.328Z'")
- assert d.year == 2007
- assert d.month == 5
- assert d.day == 7
- assert d.hour == 11
- assert d.minute == 43
- assert d.second == 55
- assert d.microsecond == 328000
- assert d.tzinfo == iso8601.UTC
-
-def test_parse_date_tz():
- d = iso8601.parse_date("2006-10-20T15:34:56.123+02:30")
- assert d.year == 2006
- assert d.month == 10
- assert d.day == 20
- assert d.hour == 15
- assert d.minute == 34
- assert d.second == 56
- assert d.microsecond == 123000
- assert d.tzinfo.tzname(None) == "+02:30"
- offset = d.tzinfo.utcoffset(None)
- assert offset.days == 0
- assert offset.seconds == 60 * 60 * 2.5
-
-def test_parse_invalid_date():
- try:
- iso8601.parse_date(None)
- except iso8601.ParseError:
- pass
- else:
- assert 1 == 2
-
-def test_parse_invalid_date2():
- try:
- iso8601.parse_date("23")
- except iso8601.ParseError:
- pass
- else:
- assert 1 == 2
-
-def test_parse_no_timezone():
- """issue 4 - Handle datetime string without timezone
-
- This tests what happens when you parse a date with no timezone. While not
- strictly correct this is quite common. I'll assume UTC for the time zone
- in this case.
- """
- d = iso8601.parse_date("2007-01-01T08:00:00")
- assert d.year == 2007
- assert d.month == 1
- assert d.day == 1
- assert d.hour == 8
- assert d.minute == 0
- assert d.second == 0
- assert d.microsecond == 0
- assert d.tzinfo == iso8601.UTC
-
-def test_parse_no_timezone_different_default():
- tz = iso8601.FixedOffset(2, 0, "test offset")
- d = iso8601.parse_date("2007-01-01T08:00:00", default_timezone=tz)
- assert d.tzinfo == tz
-
-def test_space_separator():
- """Handle a separator other than T
-
- """
- d = iso8601.parse_date("2007-06-23 06:40:34.00Z")
- assert d.year == 2007
- assert d.month == 6
- assert d.day == 23
- assert d.hour == 6
- assert d.minute == 40
- assert d.second == 34
- assert d.microsecond == 0
- assert d.tzinfo == iso8601.UTC
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 5e318c1..4203256 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -123,6 +123,7 @@ import unittest
from io import BytesIO, StringIO
from io import UnsupportedOperation as _UnsupportedOperation
+import iso8601
from testtools import ExtendedToOriginalDecorator, content, content_type
from testtools.compat import _b, _u
from testtools.content import TracebackContent
@@ -135,7 +136,7 @@ except ImportError:
"_StringException, check your version.")
from testtools import CopyStreamResult, testresult
-from subunit import chunked, details, iso8601, test_results
+from subunit import chunked, details, test_results
from subunit.v2 import ByteStreamToStreamResult, StreamResultToBytes
# same format as sys.version_info: "A tuple containing the five components of
@@ -551,7 +552,7 @@ class TestProtocolServer(object):
def _handleTime(self, offset, line):
# Accept it, but do not do anything with it yet.
try:
- event_time = iso8601.parse_date(line[offset:-1])
+ event_time = iso8601.parse_date(line[offset:-1].decode())
except TypeError:
raise TypeError(_u("Failed to parse %r, got %r")
% (line, sys.exec_info[1]))
@@ -794,7 +795,7 @@ class TestProtocolClient(testresult.TestResult):
":param datetime: A datetime.datetime object.
"""
- time = a_datetime.astimezone(iso8601.Utc())
+ time = a_datetime.astimezone(iso8601.UTC)
self._stream.write(_b("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
time.year, time.month, time.day, time.hour, time.minute,
time.second, time.microsecond)))
diff --git a/python/subunit/_output.py b/python/subunit/_output.py
index 8141dc9..48a6f7e 100644
--- a/python/subunit/_output.py
+++ b/python/subunit/_output.py
@@ -19,7 +19,7 @@ from functools import partial
from optparse import OptionGroup, OptionParser, OptionValueError
from subunit import make_stream_binary
-from subunit.iso8601 import UTC
+from iso8601 import UTC
from subunit.v2 import StreamResultToBytes
_FINAL_ACTIONS = frozenset([
diff --git a/python/subunit/iso8601.py b/python/subunit/iso8601.py
deleted file mode 100644
index fa42270..0000000
--- a/python/subunit/iso8601.py
+++ /dev/null
@@ -1,128 +0,0 @@
-# Copyright (c) 2007 Michael Twomey
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-"""ISO 8601 date time string parsing
-
-Basic usage:
->>> import iso8601
->>> iso8601.parse_date("2007-01-25T12:00:00Z")
-datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)
->>>
-
-"""
-
-import re
-from datetime import datetime, timedelta, tzinfo
-
-__all__ = ["parse_date", "ParseError"]
-
-# Adapted from http://delete.me.uk/2005/03/iso8601.html
-ISO8601_REGEX_PATTERN = (r"(?P<year>[0-9]{4})(-(?P<month>[0-9]{1,2})(-(?P<day>[0-9]{1,2})"
- r"((?P<separator>.)(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2})(:(?P<second>[0-9]{2})(\.(?P<fraction>[0-9]+))?)?"
- r"(?P<timezone>Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?"
-)
-TIMEZONE_REGEX_PATTERN = "(?P<prefix>[+-])(?P<hours>[0-9]{2}).(?P<minutes>[0-9]{2})"
-ISO8601_REGEX = re.compile(ISO8601_REGEX_PATTERN.encode('utf8'))
-TIMEZONE_REGEX = re.compile(TIMEZONE_REGEX_PATTERN.encode('utf8'))
-
-zulu = "Z".encode('latin-1')
-minus = "-".encode('latin-1')
-
-class ParseError(Exception):
- """Raised when there is a problem parsing a date string"""
-
-# Yoinked from python docs
-ZERO = timedelta(0)
-class Utc(tzinfo):
- """UTC
-
- """
- def utcoffset(self, dt):
- return ZERO
-
- def tzname(self, dt):
- return "UTC"
-
- def dst(self, dt):
- return ZERO
-UTC = Utc()
-
-class FixedOffset(tzinfo):
- """Fixed offset in hours and minutes from UTC
-
- """
- def __init__(self, offset_hours, offset_minutes, name):
- self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes)
- self.__name = name
-
- def utcoffset(self, dt):
- return self.__offset
-
- def tzname(self, dt):
- return self.__name
-
- def dst(self, dt):
- return ZERO
-
- def __repr__(self):
- return "<FixedOffset %r>" % self.__name
-
-def parse_timezone(tzstring, default_timezone=UTC):
- """Parses ISO 8601 time zone specs into tzinfo offsets
-
- """
- if tzstring == zulu:
- return default_timezone
- # This isn't strictly correct, but it's common to encounter dates without
- # timezones so I'll assume the default (which defaults to UTC).
- # Addresses issue 4.
- if tzstring is None:
- return default_timezone
- m = TIMEZONE_REGEX.match(tzstring)
- prefix, hours, minutes = m.groups()
- hours, minutes = int(hours), int(minutes)
- if prefix == minus:
- hours = -hours
- minutes = -minutes
- return FixedOffset(hours, minutes, tzstring)
-
-def parse_date(datestring, default_timezone=UTC):
- """Parses ISO 8601 dates into datetime objects
-
- The timezone is parsed from the date string. However it is quite common to
- have dates without a timezone (not strictly correct). In this case the
- default timezone specified in default_timezone is used. This is UTC by
- default.
- """
- if not isinstance(datestring, bytes):
- raise ParseError("Expecting bytes %r" % datestring)
- m = ISO8601_REGEX.match(datestring)
- if not m:
- raise ParseError("Unable to parse date string %r" % datestring)
- groups = m.groupdict()
- tz = parse_timezone(groups["timezone"], default_timezone=default_timezone)
- if groups["fraction"] is None:
- groups["fraction"] = 0
- else:
- groups["fraction"] = int(float("0.%s" % groups["fraction"].decode()) * 1e6)
- return datetime(int(groups["year"]), int(groups["month"]), int(groups["day"]),
- int(groups["hour"]), int(groups["minute"]), int(groups["second"]),
- int(groups["fraction"]), tz)
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 71a983c..be081c1 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -24,6 +24,7 @@ from testtools import StreamResult
from testtools.content import TracebackContent, text_content
from testtools.testcase import PlaceHolder
+import iso8601
import subunit
from subunit import iso8601
@@ -193,7 +194,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
time = self._time
if time is not None:
return
- time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
+ time = datetime.datetime.utcnow().replace(tzinfo=iso8601.UTC)
self.decorated.time(time)
def progress(self, offset, whence):
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py
index 0501f79..555d70a 100644
--- a/python/subunit/tests/test_output_filter.py
+++ b/python/subunit/tests/test_output_filter.py
@@ -22,6 +22,8 @@ from functools import partial
from io import BytesIO, StringIO, TextIOWrapper
from tempfile import NamedTemporaryFile
+from iso8601 import UTC
+
from testtools import TestCase
from testtools.compat import _u
from testtools.matchers import (Equals, Matcher, MatchesAny, MatchesListwise,
@@ -31,7 +33,6 @@ from testtools.testresult.doubles import StreamResult
import subunit._output as _o
from subunit._output import (_ALL_ACTIONS, _FINAL_ACTIONS,
generate_stream_results, parse_arguments)
-from subunit.iso8601 import UTC
from subunit.v2 import ByteStreamToStreamResult, StreamResultToBytes
diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py
index a3baa5c..508a5df 100644
--- a/python/subunit/tests/test_subunit_filter.py
+++ b/python/subunit/tests/test_subunit_filter.py
@@ -27,9 +27,10 @@ from testtools import TestCase
from testtools.compat import _b
from testtools.testresult.doubles import ExtendedTestResult, StreamResult
+import iso8601
import subunit
-from subunit import ByteStreamToStreamResult, StreamResultToBytes, iso8601
-from subunit.test_results import TestResultFilter, make_tag_filter
+from subunit.test_results import make_tag_filter, TestResultFilter
+from subunit import ByteStreamToStreamResult, StreamResultToBytes
class TestTestResultFilter(TestCase):
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index a40591e..7ad28d2 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -39,8 +39,9 @@ except ImportError:
from testtools.matchers import Contains, Equals, MatchesAny
+import iso8601
+
import subunit
-import subunit.iso8601 as iso8601
from subunit.tests import (_remote_exception_repr,
_remote_exception_repr_chunked,
_remote_exception_str,
@@ -981,7 +982,7 @@ class TestTestProtocolServerStreamTime(unittest.TestCase):
self.assertEqual(_b(""), self.stream.getvalue())
self.assertEqual([
('time', datetime.datetime(2001, 12, 12, 12, 59, 59, 0,
- iso8601.Utc()))
+ iso8601.UTC))
], self.result._events)
@@ -1386,7 +1387,7 @@ class TestTestProtocolClient(TestCase):
def test_time(self):
# Calling time() outputs a time signal immediately.
self.protocol.time(
- datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc()))
+ datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC))
self.assertEqual(
_b("time: 2009-10-11 12:13:14.000015Z\n"),
self.io.getvalue())
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
index 4f0eb9f..ef88092 100644
--- a/python/subunit/tests/test_test_protocol2.py
+++ b/python/subunit/tests/test_test_protocol2.py
@@ -32,7 +32,7 @@ from testtools.testresult.doubles import StreamResult
from testtools.tests.test_testresult import TestStreamResultContract
import subunit
-import subunit.iso8601 as iso8601
+import iso8601
CONSTANT_ENUM = b'\xb3)\x01\x0c\x03foo\x08U_\x1b'
CONSTANT_INPROGRESS = b'\xb3)\x02\x0c\x03foo\x8e\xc1-\xb5'
@@ -218,7 +218,7 @@ class TestStreamResultToBytes(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
result, output = self._make_result()
result.status(test_id="bar", test_status='success', timestamp=timestamp)
self.assertEqual(CONSTANT_TIMESTAMP, output.getvalue())
@@ -382,7 +382,7 @@ class TestByteStreamToStreamResult(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
self.check_event(CONSTANT_TIMESTAMP,
'success', test_id='bar', timestamp=timestamp)
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index 765454a..fc14133 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -26,7 +26,7 @@ from testtools.content import TracebackContent, text_content
from testtools.testresult.doubles import ExtendedTestResult
import subunit
-import subunit.iso8601 as iso8601
+import iso8601
import subunit.test_results
@@ -174,7 +174,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
def test_calling_time_inhibits_automatic_time(self):
# Calling time() outputs a time signal immediately and prevents
# automatically adding one when other methods are called.
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.result.startTest(self)
self.result.stopTest(self)
@@ -182,7 +182,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
self.assertEqual(time, self.decorated._calls[0])
def test_calling_time_None_enables_automatic_time(self):
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.assertEqual(1, len(self.decorated._calls))
self.assertEqual(time, self.decorated._calls[0])
diff --git a/python/subunit/v2.py b/python/subunit/v2.py
index d344aff..9619f3c 100644
--- a/python/subunit/v2.py
+++ b/python/subunit/v2.py
@@ -23,7 +23,7 @@ import sys
import zlib
import subunit
-import subunit.iso8601 as iso8601
+import iso8601
utf_8_decode = codecs.utf_8_decode
@@ -46,7 +46,7 @@ FLAG_TAGS = 0x0080
FLAG_MIME_TYPE = 0x0020
FLAG_EOF = 0x0010
FLAG_FILE_CONTENT = 0x0040
-EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.Utc())
+EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.UTC)
NUL_ELEMENT = b'\0'[0]
# Contains True for types for which 'nul in thing' falsely returns false.
_nul_test_broken = {}
diff --git a/setup.py b/setup.py
index 7bb270a..7938e75 100755
--- a/setup.py
+++ b/setup.py
@@ -59,6 +59,7 @@ setup(
package_dir={'subunit': 'python/subunit'},
python_requires=">=3.7",
install_requires=[
+ 'iso8601',
'testtools>=0.9.34',
],
entry_points={