- Update to 1.0.4:

* Various small fixes, see CHANGELOG.rst
- Merge patch faker-32bit.patch
- Update to 1.0.2:

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Faker?expand=0&rev=20
This commit is contained in:
Tomáš Chvátal 2019-03-14 14:34:55 +00:00 committed by Git OBS Bridge
parent 5717d27503
commit 0cd20a600c
5 changed files with 17 additions and 111 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d871ea315b2dcba9138b8344f2c131a76ac62d6227ca39f69b0c889fec97376c
size 933017

3
Faker-1.0.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:745ac8b9c9526e338696e07b7f2e206e5e317e5744e22fdd7c2894bf19af41f1
size 803706

View File

@ -1,102 +0,0 @@
From 26260b97bee18e2b1ace7cd0f450215f35fd667e Mon Sep 17 00:00:00 2001
From: Flavio Curella <89607+fcurella@users.noreply.github.com>
Date: Mon, 11 Mar 2019 13:38:18 -0500
Subject: [PATCH] Close #912. Skip tests on 32bit systems (#922)
---
.dockerignore | 16 ++++++++++++++++
.travis.yml | 9 ++++++---
MANIFEST.in | 3 ++-
build32bit.sh | 10 ++++++++++
faker/providers/date_time/__init__.py | 18 ++++++++++++------
setup.py | 4 ++--
tests/providers/test_date_time.py | 8 ++++++++
tox.ini | 8 ++++++--
8 files changed, 62 insertions(+), 14 deletions(-)
create mode 100644 .dockerignore
create mode 100755 build32bit.sh
diff --git a/faker/providers/date_time/__init__.py b/faker/providers/date_time/__init__.py
index ed27c9f4..7158307a 100644
--- a/faker/providers/date_time/__init__.py
+++ b/faker/providers/date_time/__init__.py
@@ -11,8 +11,8 @@
from dateutil import relativedelta
from dateutil.tz import tzlocal, tzutc
-from faker.utils.datetime_safe import date, datetime, real_date, real_datetime
from faker.utils import is_string
+from faker.utils.datetime_safe import date, datetime, real_date, real_datetime
from .. import BaseProvider
@@ -1664,11 +1664,17 @@ def date_time_between_dates(
datetime_to_timestamp(datetime_start),
datetime_to_timestamp(datetime_end),
)
- if tzinfo is None:
- pick = datetime.fromtimestamp(timestamp, tzlocal())
- pick = pick.astimezone(tzutc()).replace(tzinfo=None)
- else:
- pick = datetime.fromtimestamp(timestamp, tzinfo)
+ try:
+ if tzinfo is None:
+ pick = datetime.fromtimestamp(timestamp, tzlocal())
+ pick = pick.astimezone(tzutc()).replace(tzinfo=None)
+ else:
+ pick = datetime.fromtimestamp(timestamp, tzinfo)
+ except OverflowError:
+ raise OverflowError(
+ "You specified an end date with a timestamp bigger than the maximum allowed on this"
+ " system. Please specify an earlier date.",
+ )
return pick
def date_between_dates(self, date_start=None, date_end=None):
diff --git a/tests/providers/test_date_time.py b/tests/providers/test_date_time.py
index 6f80ed54..67c974cb 100644
--- a/tests/providers/test_date_time.py
+++ b/tests/providers/test_date_time.py
@@ -6,6 +6,7 @@
import time
import unittest
import random
+import sys
import six
@@ -18,6 +19,10 @@
import pytest
+def is64bit():
+ return sys.maxsize > 2**32
+
+
class UTC(tzinfo):
"""
UTC implementation taken from Python's docs.
@@ -225,6 +230,7 @@ def test_date_between_dates(self):
def _datetime_to_time(self, value):
return int(time.mktime(value.timetuple()))
+ @unittest.skipUnless(is64bit(), "requires 64bit")
def test_date_time_this_period(self):
# test century
this_century_start = self._datetime_to_time(
@@ -292,6 +298,7 @@ def test_date_time_this_period(self):
self._datetime_to_time(datetime.now())
)
+ @unittest.skipUnless(is64bit(), "requires 64bit")
def test_date_time_this_period_with_tzinfo(self):
# ensure all methods provide timezone aware datetimes
with pytest.raises(TypeError):
@@ -329,6 +336,7 @@ def test_date_time_this_period_with_tzinfo(self):
replace(second=0, microsecond=0) == datetime.now(utc).replace(second=0, microsecond=0)
)
+ @unittest.skipUnless(is64bit(), "requires 64bit")
def test_date_this_period(self):
# test century
assert self.factory.date_this_century(after_today=False) <= date.today()

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Mar 14 14:26:07 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.0.4:
* Various small fixes, see CHANGELOG.rst
- Merge patch faker-32bit.patch
-------------------------------------------------------------------
Tue Mar 12 09:24:13 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
@ -14,7 +21,7 @@ Sun Mar 10 10:15:00 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
-------------------------------------------------------------------
Thu Feb 14 14:44:47 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.0.10:
- Update to 1.0.2:
* Many changes to list see CHANGELOG.rst
- Run tests

View File

@ -19,20 +19,21 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-Faker
Version: 1.0.2
Version: 1.0.4
Release: 0
Summary: Faker is a Python package that generates fake data
License: MIT
Group: Development/Languages/Python
URL: https://github.com/joke2k/faker
Source: https://files.pythonhosted.org/packages/source/F/Faker/Faker-%{version}.tar.gz
Patch0: faker-32bit.patch
BuildRequires: %{python_module UkPostcodeParser >= 1.1.1}
BuildRequires: %{python_module email_validator >= 1.0.2}
BuildRequires: %{python_module freezegun >= 0.3.11}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module more-itertools}
BuildRequires: %{python_module pytest >= 3.8.0}
BuildRequires: %{python_module python-dateutil >= 2.4}
BuildRequires: %{python_module random2 >= 1.0.1}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six >= 1.10}
BuildRequires: %{python_module text-unidecode >= 1.2}
@ -66,9 +67,9 @@ testing, and data anonymization from production services.
%setup -q -n Faker-%{version}
# Remove pre-existing bytecode files in the sdist
find . -name '*.py[co]' -delete
# do not hardcode pytest version
# do not hardcode versions
sed -i -e 's:"pytest>=3.8.0,<3.9":"pytest>=3.8.0":g' setup.py
%patch0 -p1
sed -i -e 's:==:>=:g' setup.py
%build
%python_build
@ -85,7 +86,7 @@ sed -i -e 's:"pytest>=3.8.0,<3.9":"pytest>=3.8.0":g' setup.py
%python_uninstall_alternative faker
%check
%python_exec setup.py test
%pytest
%files %{python_files}
%license LICENSE.txt