1
# Copyright (C) 2005 by 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 version 2 as published by
5
# the Free Software Foundation.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
"""UI tests for the test framework."""
19
from bzrlib.errors import ParamikoNotPresent
20
from bzrlib.tests import (
27
class TestOptions(TestCase):
31
def test_transport_set_to_sftp(self):
32
# test the --transport option has taken effect from within the
35
import bzrlib.transport.sftp
36
except ParamikoNotPresent:
37
raise TestSkipped("Paramiko not present")
38
if TestOptions.current_test != "test_transport_set_to_sftp":
40
self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
41
bzrlib.tests.default_transport)
43
def test_transport_set_to_memory(self):
44
# test the --transport option has taken effect from within the
46
import bzrlib.transport.memory
47
if TestOptions.current_test != "test_transport_set_to_memory":
49
self.assertEqual(bzrlib.transport.memory.MemoryServer,
50
bzrlib.tests.default_transport)
52
def test_transport(self):
53
# test that --transport=sftp works
55
import bzrlib.transport.sftp
56
except ParamikoNotPresent:
57
raise TestSkipped("Paramiko not present")
58
old_transport = bzrlib.tests.default_transport
59
old_root = TestCaseInTempDir.TEST_ROOT
60
TestCaseInTempDir.TEST_ROOT = None
62
TestOptions.current_test = "test_transport_set_to_sftp"
63
stdout = self.capture('selftest --transport=sftp test_transport_set_to_sftp')
65
self.assertContainsRe(stdout, 'Ran 1 test')
66
self.assertEqual(old_transport, bzrlib.tests.default_transport)
68
TestOptions.current_test = "test_transport_set_to_memory"
69
stdout = self.capture('selftest --transport=memory test_transport_set_to_memory')
70
self.assertContainsRe(stdout, 'Ran 1 test')
71
self.assertEqual(old_transport, bzrlib.tests.default_transport)
73
bzrlib.tests.default_transport = old_transport
74
TestOptions.current_test = None
75
TestCaseInTempDir.TEST_ROOT = old_root