~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_alias.py

(jameinel) Allow 'bzr serve' to interpret SIGHUP as a graceful shutdown.
 (bug #795025) (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
#
17
17
 
18
18
"""Tests of the 'bzr alias' command."""
19
 
import os
20
 
import codecs
21
 
 
22
 
from bzrlib.tests.blackbox import ExternalBase
23
 
from bzrlib.config import (ensure_config_dir_exists, config_filename)
24
 
 
25
 
 
26
 
class TestAlias(ExternalBase):
 
19
 
 
20
from bzrlib import (
 
21
    config,
 
22
    tests,
 
23
    )
 
24
from bzrlib.tests import (
 
25
    features,
 
26
    )
 
27
 
 
28
 
 
29
class TestAlias(tests.TestCaseWithTransport):
27
30
 
28
31
    def test_list_alias_with_none(self):
29
32
        """Calling alias with no parameters lists existing aliases."""
46
49
 
47
50
    def test_unicode_alias(self):
48
51
        """Unicode aliases should work (Bug #529930)"""
49
 
        config_enc = 'utf-8'
 
52
        # XXX: strictly speaking, lack of unicode filenames doesn't imply that
 
53
        # unicode command lines aren't available.
 
54
        self.requireFeature(features.UnicodeFilenameFeature)
50
55
        file_name = u'foo\xb6'
51
56
 
52
57
        tree = self.make_branch_and_tree('.')
54
59
        tree.add(file_name)
55
60
        tree.commit('added')
56
61
 
57
 
        ensure_config_dir_exists()
58
 
        CONFIG=(u'[ALIASES]\n'
59
 
                u'ust=st foo\xb6\n')
60
 
 
61
 
        codecs.open(config_filename(),'w', config_enc).write(CONFIG)
 
62
        config.GlobalConfig.from_string(
 
63
            u'[ALIASES]\nust=st %s\n' % (file_name,), save=True)
62
64
 
63
65
        out, err = self.run_bzr('ust')
64
66
        self.assertEquals(err, '')