From 831fc411704fb7cd33e4a82e1b3af4530574b67f6fd6318713b7f11358423b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Tue, 28 Nov 2017 23:46:58 +0000 Subject: [PATCH] Accepting request 546304 from home:bmwiedemann:branches:devel:languages:python Add python-fs-fix-ftp-test.patch to make ftp tests pass in 2018 OBS-URL: https://build.opensuse.org/request/show/546304 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fs?expand=0&rev=8 --- python-fs-fix-ftp-test.patch | 62 ++++++++++++++++++++++++++++++++++++ python-fs.changes | 5 +++ python-fs.spec | 3 ++ 3 files changed, 70 insertions(+) create mode 100644 python-fs-fix-ftp-test.patch diff --git a/python-fs-fix-ftp-test.patch b/python-fs-fix-ftp-test.patch new file mode 100644 index 0000000..9b176fa --- /dev/null +++ b/python-fs-fix-ftp-test.patch @@ -0,0 +1,62 @@ +Date: 2017-11-28 +Author: Bernhard M. Wiedemann + +Make ftp tests pass in 2018 + +The previous code assumed that time.localtime would return tm_year=2017 + +Someone could probably upstream a fix using unittest.mock +for time.localtime with +return_value = time.struct_time(tm_year=2017, tm_mon=11, tm_mday=28, tm_hour=19, tm_min=21, tm_sec=19, tm_wday=1, tm_yday=332, tm_isdst=0) + +Index: fs-2.0.4/tests/test_ftp_parse.py +=================================================================== +--- fs-2.0.4.orig/tests/test_ftp_parse.py ++++ fs-2.0.4/tests/test_ftp_parse.py +@@ -15,12 +15,6 @@ class TestFTPParse(unittest.TestCase): + 142214400.0 + ) + +- year = time.localtime().tm_year +- self.assertEqual( +- ftp_parse._parse_time('JUL 05 02:00'), +- 1499220000.0 +- ) +- + self.assertEqual( + ftp_parse._parse_time("notadate"), + None +@@ -35,9 +29,9 @@ class TestFTPParse(unittest.TestCase): + def test_decode_linux(self): + directory = """\ + lrwxrwxrwx 1 0 0 19 Jan 18 2006 debian -> ./pub/mirror/debian +-drwxr-xr-x 10 0 0 4096 Aug 03 09:21 debian-archive ++drwxr-xr-x 10 0 0 4096 Jan 18 2006 debian-archive + lrwxrwxrwx 1 0 0 27 Nov 30 2015 debian-backports -> pub/mirror/debian-backports +-drwxr-xr-x 12 0 0 4096 Sep 29 13:13 pub ++drwxr-xr-x 12 0 0 4096 Jan 18 2006 pub + -rw-r--r-- 1 0 0 26 Mar 04 2010 robots.txt + """ + +@@ -65,8 +59,8 @@ drwxr-xr-x 12 0 0 40 + u'u_x'], + u'user': u'0'}, + u'basic': {u'is_dir': True, u'name': u'debian-archive'}, +- u'details': {u'modified': 1501752060.0, u'size': 4096, u'type': 1}, +- u'ftp': {u'ls': u'drwxr-xr-x 10 0 0 4096 Aug 03 09:21 debian-archive'}}, ++ u'details': {u'modified': 1137542400.0, u'size': 4096, u'type': 1}, ++ u'ftp': {u'ls': u'drwxr-xr-x 10 0 0 4096 Jan 18 2006 debian-archive'}}, + {u'access': {u'group': u'0', + u'permissions': [u'g_r', + u'g_w', +@@ -91,8 +85,8 @@ drwxr-xr-x 12 0 0 40 + u'u_x'], + u'user': u'0'}, + u'basic': {u'is_dir': True, u'name': u'pub'}, +- u'details': {u'modified': 1506690780.0, u'size': 4096, u'type': 1}, +- u'ftp': {u'ls': u'drwxr-xr-x 12 0 0 4096 Sep 29 13:13 pub'}}, ++ u'details': {u'modified': 1137542400.0, u'size': 4096, u'type': 1}, ++ u'ftp': {u'ls': u'drwxr-xr-x 12 0 0 4096 Jan 18 2006 pub'}}, + {u'access': {u'group': u'0', + u'permissions': [u'g_r', u'o_r', u'u_r', u'u_w'], + u'user': u'0'}, diff --git a/python-fs.changes b/python-fs.changes index cbbbb8f..6e39cd4 100644 --- a/python-fs.changes +++ b/python-fs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Nov 28 19:41:26 UTC 2017 - bwiedemann@suse.com + +- Add python-fs-fix-ftp-test.patch to make ftp tests pass in 2018 + ------------------------------------------------------------------- Thu Aug 3 20:42:12 UTC 2017 - toddrme2178@gmail.com diff --git a/python-fs.spec b/python-fs.spec index dc5ada6..56961f2 100644 --- a/python-fs.spec +++ b/python-fs.spec @@ -29,6 +29,8 @@ Url: https://github.com/PyFilesystem/pyfilesystem2 Source: https://files.pythonhosted.org/packages/source/f/fs/fs-%{version}.tar.gz # PATCH-FIX-UPSTREAM more-relaxed-requirements.patch sebix+novell.com@sebix.at -- Weaken the version dependencies Patch0: more-relaxed-requirements.patch +# PATCH-FIX-OPENSUSE make ftp tests pass in 2018 +Patch1: python-fs-fix-ftp-test.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros @@ -63,6 +65,7 @@ any of the supported filesystems (zip, ftp, S3 etc.). %prep %setup -q -n fs-%{version} %patch0 +%patch1 -p1 %build %python_build