diff --git a/569.patch b/569.patch new file mode 100644 index 0000000..810921f --- /dev/null +++ b/569.patch @@ -0,0 +1,60 @@ +From ef65e71446eb0b84df828cd129b639c68ffcbef4 Mon Sep 17 00:00:00 2001 +From: scottbelden +Date: Mon, 25 Oct 2021 17:47:51 -0400 +Subject: [PATCH] make test more robust + +--- + developer_requirements.txt | 1 - + tests/test_logical_types.py | 12 ++++-------- + 2 files changed, 4 insertions(+), 9 deletions(-) + +diff --git a/developer_requirements.txt b/developer_requirements.txt +index 23d6fbf4..6f7216f2 100644 +--- a/developer_requirements.txt ++++ b/developer_requirements.txt +@@ -9,7 +9,6 @@ wheel + twine + coverage + codecov +-python-dateutil + mypy; implementation_name != "pypy" + black; implementation_name != "pypy" + +diff --git a/tests/test_logical_types.py b/tests/test_logical_types.py +index 93ac56da..db7583e9 100644 +--- a/tests/test_logical_types.py ++++ b/tests/test_logical_types.py +@@ -9,7 +9,6 @@ + import datetime + import sys + import os +-from dateutil.tz import tzlocal + from datetime import timezone, timedelta + import numpy as np + +@@ -147,9 +146,6 @@ def test_ancient_datetime(): + "type": "record", + } + +- my_epoch = datetime.datetime(1970, 1, 1, tzinfo=tzlocal()) +- diff = my_epoch - datetime.datetime(1970, 1, 1, tzinfo=timezone.utc) +- + data1 = { + "timestamp-millis": datetime.datetime(1960, 1, 1), + "timestamp-micros": datetime.datetime(1960, 1, 1), +@@ -157,11 +153,11 @@ def test_ancient_datetime(): + binary = serialize(schema_datetime, data1) + data2 = deserialize(schema_datetime, binary) + +- assert (data1["timestamp-millis"] + diff) == data2["timestamp-millis"].replace( +- tzinfo=None ++ assert_naive_datetime_equal_to_tz_datetime( ++ data1["timestamp-millis"], data2["timestamp-millis"] + ) +- assert (data1["timestamp-micros"] + diff) == data2["timestamp-micros"].replace( +- tzinfo=None ++ assert_naive_datetime_equal_to_tz_datetime( ++ data1["timestamp-micros"], data2["timestamp-micros"] + ) + + diff --git a/python-fastavro.spec b/python-fastavro.spec index 4dd5c30..98186df 100644 --- a/python-fastavro.spec +++ b/python-fastavro.spec @@ -6,7 +6,7 @@ Name: python-fastavro Version: 1.4.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Fast Avro for Python # The fastavro project is licensed MIT, but is derived from Apache Avro which @@ -27,6 +27,11 @@ Source0: %{pypi_source fastavro} # Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=1943932 ExcludeArch: %{arm32} %{ix86} +# Fix: test_ancient_datetime test fails in timezone with offset that changed +# since 1960 (https://github.com/fastavro/fastavro/pull/569.patch) +# Upstream issue: https://github.com/fastavro/fastavro/issues/568 +Patch0: %{url}/pull/569.patch + BuildRequires: python3-devel BuildRequires: %{py3_dist Cython} BuildRequires: gcc @@ -90,7 +95,7 @@ Documentation for python-fastavro. %prep -%autosetup -n fastavro-%{version} +%autosetup -n fastavro-%{version} -p1 # Remove the already generated C files so we generate them ourselves find fastavro/ -name '*.c' -print -delete @@ -182,6 +187,10 @@ k="${k-}${k+ and }not test_regular_vs_ordered_dict_record_typeerror" %changelog +* Mon Oct 25 2021 Benjamin A. Beasley - 1.4.6-3 +- Fix: test_ancient_datetime test fails in timezone with offset that changed + since 1960 + * Mon Oct 25 2021 Benjamin A. Beasley - 1.4.6-2 - Work around RHBZ#1905174 in F34 in python-check-manifest