SHA256
15
0
forked from pool/python-fs

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
This commit is contained in:
2017-11-28 23:46:58 +00:00
committed by Git OBS Bridge
parent 1904e55792
commit 831fc41170
3 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
Date: 2017-11-28
Author: Bernhard M. Wiedemann <bwiedemann suse de>
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'},

View File

@@ -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

View File

@@ -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