Added check for pyftpdlib when running FTP test.

This commit is contained in:
Bastian Kleineidam 2010-03-09 07:49:43 +01:00
parent c88791b815
commit 0af3cece1b
3 changed files with 16 additions and 3 deletions

View file

@ -131,12 +131,23 @@ def has_proxy ():
s.close()
return True
except StandardError:
pass
return False
return False
need_proxy = _need_func(has_proxy, "proxy")
@memoized
def has_pyftpdlib ():
"""Test if pyftpdlib is available."""
try:
import pyftpdlib
return True
except ImportError:
return False
need_pyftpdlib = _need_func(has_pyftpdlib, "pyftpdlib")
@memoized
def has_newsserver (server):
try:

View file

@ -20,7 +20,6 @@ Define http test support classes for LinkChecker tests.
import sys
import os
import time
from pyftpdlib import ftpserver
from . import LinkCheckTest
@ -62,6 +61,7 @@ def start_server (host, port):
if "kill" in msg:
sys.exit(0)
from pyftpdlib import ftpserver
authorizer = ftpserver.DummyAuthorizer()
datadir = os.path.join(os.path.dirname(__file__), 'data')
authorizer.add_anonymous(datadir)

View file

@ -17,12 +17,14 @@
"""
FTP checking.
"""
from .. import need_pyftpdlib
from .ftpserver import FtpServerTest
class TestFtp (FtpServerTest):
"""Test ftp: link checking."""
@need_pyftpdlib
def test_ftp (self):
try:
# ftp two slashes