summaryrefslogtreecommitdiff
path: root/community
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-05 10:34:35 +0200
committerErich Eckner <git@eckner.net>2018-09-05 10:34:35 +0200
commit93c72c41c261db78b13de9d37360a3dc43371c8d (patch)
treeebc4ffcdfc537fa801a2b5884a99de14e7fc731d /community
parente7077f0ab72f09e4d630d44058f1008f3c670cf4 (diff)
downloadpackages-93c72c41c261db78b13de9d37360a3dc43371c8d.tar.xz
community/python-faker: use sed instead of patch to remove future-century tests
Diffstat (limited to 'community')
-rw-r--r--community/python-faker/PKGBUILD15
-rw-r--r--community/python-faker/remove-century-tests.patch38
2 files changed, 9 insertions, 44 deletions
diff --git a/community/python-faker/PKGBUILD b/community/python-faker/PKGBUILD
index 87168ec5..891d7841 100644
--- a/community/python-faker/PKGBUILD
+++ b/community/python-faker/PKGBUILD
@@ -1,15 +1,18 @@
# https://github.com/joke2k/faker/issues/408
# time-tests requiring 64 bit fail on i686 - obviously (year 2100 is not representable with 32 bits)
-source+=('remove-century-tests.patch')
-sha512sums+=('69d6c7685f49d28bc5a4ea952d6f0f6ab03e7c9956e338fc7e26d6a714de569641b82e95bb30de15b4598b6fbf3fb8e0a497fde2e28bd988fafbeb030bb24f91')
-
eval "$(
declare -f prepare | \
sed '
/^{\s*$/a \
- cd "$srcdir"/faker-$pkgver\
- patch -p1 -i "$srcdir/remove-century-tests.patch"\
- cd "$srcdir"
+ sed -i '"'"'/\\.date_\\(time_\\)\\?this_century(.*) >= /d'"'"' "$srcdir/faker-$pkgver/tests/providers/test_date_time.py" \
+ sed -i '"'"' \
+ $! N; \
+ /^\\(.\\+\\)\\n\\1$/ ! { \
+ P; \
+ D; \
+ } \
+ D; \
+ '"'"' "$srcdir/faker-$pkgver/tests/providers/test_date_time.py" \
'
)"
diff --git a/community/python-faker/remove-century-tests.patch b/community/python-faker/remove-century-tests.patch
deleted file mode 100644
index 57cddebf..00000000
--- a/community/python-faker/remove-century-tests.patch
+++ /dev/null
@@ -1,38 +0,0 @@
---- faker-0.8.4/tests/providers/test_date_time.py 2017-09-22 21:52:06.000000000 +0200
-+++ test_date_time.py 2017-09-25 11:14:26.013321696 +0200
-@@ -203,9 +203,6 @@
- return int(time.mktime(value.timetuple()))
-
- def test_date_time_this_period(self):
-- # test century
-- self.assertTrue(self._datetime_to_time(self.factory.date_time_this_century(after_now=False)) <= self._datetime_to_time(datetime.now()))
-- self.assertTrue(self._datetime_to_time(self.factory.date_time_this_century(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.now()))
- # test decade
- self.assertTrue(self._datetime_to_time(self.factory.date_time_this_decade(after_now=False)) <= self._datetime_to_time(datetime.now()))
- self.assertTrue(self._datetime_to_time(self.factory.date_time_this_decade(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.now()))
-@@ -231,17 +228,12 @@
- def test_date_time_this_period_with_tzinfo(self):
- # ensure all methods provide timezone aware datetimes
- with self.assertRaises(TypeError):
-- self.factory.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.now()
-- with self.assertRaises(TypeError):
- self.factory.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.now()
- with self.assertRaises(TypeError):
- self.factory.date_time_this_year(after_now=False, tzinfo=utc) <= datetime.now()
- with self.assertRaises(TypeError):
- self.factory.date_time_this_month(after_now=False, tzinfo=utc) <= datetime.now()
-
-- # test century
-- self.assertTrue(self.factory.date_time_this_century(after_now=False, tzinfo=utc) <= datetime.now(utc))
-- self.assertTrue(self.factory.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.now(utc))
- # test decade
- self.assertTrue(self.factory.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.now(utc))
- self.assertTrue(self.factory.date_time_this_decade(before_now=False, after_now=True, tzinfo=utc) >= datetime.now(utc))
-@@ -268,7 +260,6 @@
- def test_date_this_period(self):
- # test century
- self.assertTrue(self.factory.date_this_century(after_today=False) <= date.today())
-- self.assertTrue(self.factory.date_this_century(before_today=False, after_today=True) >= date.today())
- # test decade
- self.assertTrue(self.factory.date_this_decade(after_today=False) <= date.today())
- self.assertTrue(self.factory.date_this_decade(before_today=False, after_today=True) >= date.today())