bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
1185.51.1
by Martin Pool
Better message when failing to import a test suite. |
1 |
# Copyright (C) 2005 by Canonical Ltd
|
2 |
#
|
|
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.
|
|
6 |
#
|
|
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.
|
|
11 |
#
|
|
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
|
|
15 |
||
16 |
"""Tests for the test framework
|
|
17 |
"""
|
|
18 |
||
19 |
import os |
|
20 |
import sys |
|
21 |
||
|
1526.1.1
by Robert Collins
Run the test suite with no locale as well as the default locale. Also add a test for build_tree_shape to selftest. |
22 |
from bzrlib.tests import TestCase, TestCaseInTempDir, _load_module_by_name |
|
1185.51.1
by Martin Pool
Better message when failing to import a test suite. |
23 |
|
24 |
||
25 |
class SelftestTests(TestCase): |
|
26 |
||
27 |
def test_import_tests(self): |
|
28 |
mod = _load_module_by_name('bzrlib.tests.test_selftest') |
|
29 |
self.assertEqual(mod.SelftestTests, SelftestTests) |
|
30 |
||
31 |
def test_import_test_failure(self): |
|
32 |
self.assertRaises(ImportError, |
|
33 |
_load_module_by_name, |
|
34 |
'bzrlib.no-name-yet') |
|
35 |
||
36 |
||
37 |
class MetaTestLog(TestCase): |
|
|
1526.1.1
by Robert Collins
Run the test suite with no locale as well as the default locale. Also add a test for build_tree_shape to selftest. |
38 |
|
|
1185.51.1
by Martin Pool
Better message when failing to import a test suite. |
39 |
def test_logging(self): |
40 |
"""Test logs are captured when a test fails.""" |
|
41 |
self.log('a test message') |
|
42 |
self._log_file.flush() |
|
43 |
self.assertContainsRe(self._get_log(), 'a test message\n') |
|
|
1526.1.1
by Robert Collins
Run the test suite with no locale as well as the default locale. Also add a test for build_tree_shape to selftest. |
44 |
|
45 |
||
46 |
class TestTreeShape(TestCaseInTempDir): |
|
47 |
||
48 |
def test_unicode_paths(self): |
|
49 |
filename = u'hell\u00d8' |
|
50 |
self.build_tree_contents([(filename, 'contents of hello')]) |
|
51 |
self.failUnlessExists(filename) |