1
# Copyright (C) 2009 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
Facilities to use ftp test servers.
20
from bzrlib import tests
24
from bzrlib.tests.ftp_server import medusa_based
25
medusa_available = True
27
medusa_available = False
30
class _FTPServerFeature(tests.Feature):
31
"""Some tests want an FTP Server, check if one is available.
33
Right now, the only way this is available is if 'medusa' is installed.
34
http://www.amk.ca/python/code/medusa.html
38
return medusa_available
40
def feature_name(self):
44
FTPServerFeature = _FTPServerFeature()
47
class UnavailableFTPServer(object):
48
"""Dummy ftp test server.
51
This allows the test suite report the number of tests needing that
52
feature. We raise UnavailableFeature from methods before the test server is
53
being used. Doing so in the setUp method has bad side-effects (tearDown is
57
def setUp(self, vfs_server=None):
64
raise tests.UnavailableFeature(FTPServerFeature)
66
def get_bogus_url(self):
67
raise tests.UnavailableFeature(FTPServerFeature)
71
FTPServer = medusa_based.FTPServer
73
FTPServer = UnavailableFTPServer