Closed
Description
Hi all.
I know that Python-3.8.0-rc1 is not supported yet but i wish to point out following error anyway:
____________________________ HandlerTests.test_ftp _____________________________
self = <test_future.test_urllib2.HandlerTests testMethod=test_ftp>
def test_ftp(self):
class MockFTPWrapper(object):
def __init__(self, data): self.data = data
def retrfile(self, filename, filetype):
self.filename, self.filetype = filename, filetype
return io.StringIO(self.data), len(self.data)
def close(self): pass
class NullFTPHandler(urllib_request.FTPHandler):
def __init__(self, data): self.data = data
def connect_ftp(self, user, passwd, host, port, dirs,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.user, self.passwd = user, passwd
self.host, self.port = host, port
self.dirs = dirs
self.ftpwrapper = MockFTPWrapper(self.data)
return self.ftpwrapper
import ftplib
data = "rheum rhaponicum"
h = NullFTPHandler(data)
h.parent = MockOpener()
for url, host, port, user, passwd, type_, dirs, filename, mimetype in [
("ftp://localhost/foo/bar/baz.html",
"localhost", ftplib.FTP_PORT, "", "", "I",
["foo", "bar"], "baz.html", "text/html"),
("ftp://parrot@localhost/foo/bar/baz.html",
"localhost", ftplib.FTP_PORT, "parrot", "", "I",
["foo", "bar"], "baz.html", "text/html"),
("ftp://%25parrot@localhost/foo/bar/baz.html",
"localhost", ftplib.FTP_PORT, "%parrot", "", "I",
["foo", "bar"], "baz.html", "text/html"),
("ftp://%2542parrot@localhost/foo/bar/baz.html",
"localhost", ftplib.FTP_PORT, "%42parrot", "", "I",
["foo", "bar"], "baz.html", "text/html"),
("ftp://localhost:80/foo/bar/",
"localhost", 80, "", "", "D",
["foo", "bar"], "", None),
("ftp://localhost/baz.gif;type=a",
"localhost", ftplib.FTP_PORT, "", "", "A",
[], "baz.gif", None), # XXX really this should guess image/gif
]:
req = Request(url)
req.timeout = None
r = h.ftp_open(req)
# ftp authentication not yet implemented by FTPHandler
self.assertEqual(h.user, user)
self.assertEqual(h.passwd, passwd)
self.assertEqual(h.host, socket.gethostbyname(host))
self.assertEqual(h.port, port)
self.assertEqual(h.dirs, dirs)
self.assertEqual(h.ftpwrapper.filename, filename)
self.assertEqual(h.ftpwrapper.filetype, type_)
headers = r.info()
> self.assertEqual(headers.get("Content-type"), mimetype)
E AssertionError: 'image/gif' != None
tests/test_future/test_urllib2.py:726: AssertionError
__________________________________ test_main ___________________________________
verbose = None
def test_main(verbose=None):
# support.run_doctest(test_urllib2, verbose)
# support.run_doctest(urllib_request, verbose)
tests = (TrivialTests,
OpenerDirectorTests,
HandlerTests,
MiscTests,
RequestTests,
RequestHdrsTests)
> support.run_unittest(*tests)
tests/test_future/test_urllib2.py:1562:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
build/lib/future/backports/test/support.py:1665: in run_unittest
_run_suite(suite)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
suite = <unittest.suite.TestSuite tests=[None, None, None, None, None, None]>
def _run_suite(suite):
"""Run tests from a unittest.TestSuite-derived class."""
if verbose:
runner = unittest.TextTestRunner(sys.stdout, verbosity=2,
failfast=failfast)
else:
runner = BasicTestRunner()
result = runner.run(suite)
if not result.wasSuccessful():
if len(result.errors) == 1 and not result.failures:
err = result.errors[0][1]
elif len(result.failures) == 1 and not result.errors:
err = result.failures[0][1]
else:
err = "multiple errors occurred"
if not verbose: err += "; run in verbose mode for details"
> raise TestFailed(err)
E future.backports.test.support.TestFailed: Traceback (most recent call last):
E File "/builddir/build/BUILD/python-future-23989c4d61a5e3b2308b107efc1402bc727e8fe6/python3/tests/test_future/test_urllib2.py", line 726, in test_ftp
E self.assertEqual(headers.get("Content-type"), mimetype)
E AssertionError: 'image/gif' != None
build/lib/future/backports/test/support.py:1640: TestFailed
----------------------------- Captured stdout call -----------------------------
Metadata
Metadata
Assignees
Labels
No labels