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.tests import (
26
class TestOptions(TestCase):
30
def test_transport_set_to_sftp(self):
31
# test the --transport option has taken effect from within the
33
import bzrlib.transport.sftp
34
if TestOptions.current_test != "test_transport_set_to_sftp":
36
self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
37
bzrlib.tests.default_transport)
39
def test_transport_set_to_memory(self):
40
# test the --transport option has taken effect from within the
42
import bzrlib.transport.memory
43
if TestOptions.current_test != "test_transport_set_to_memory":
45
self.assertEqual(bzrlib.transport.memory.MemoryServer,
46
bzrlib.tests.default_transport)
48
def test_transport(self):
49
# test that --transport=sftp works
50
# FIXME RBC 20060123 this should raise TestSkipped if sftp is not
52
old_transport = bzrlib.tests.default_transport
53
old_root = TestCaseInTempDir.TEST_ROOT
54
TestCaseInTempDir.TEST_ROOT = None
56
TestOptions.current_test = "test_transport_set_to_sftp"
57
stdout = self.capture('selftest --transport=sftp test_transport_set_to_sftp')
59
self.assertContainsRe(stdout, 'Ran 1 test')
60
self.assertEqual(old_transport, bzrlib.tests.default_transport)
62
TestOptions.current_test = "test_transport_set_to_memory"
63
stdout = self.capture('selftest --transport=memory test_transport_set_to_memory')
64
self.assertContainsRe(stdout, 'Ran 1 test')
65
self.assertEqual(old_transport, bzrlib.tests.default_transport)
67
bzrlib.tests.default_transport = old_transport
68
TestOptions.current_test = None
69
TestCaseInTempDir.TEST_ROOT = old_root