forked from pool/python-fs
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
63 lines
2.8 KiB
Diff
63 lines
2.8 KiB
Diff
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'},
|