~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-26 20:32:49 UTC
  • mto: (2581.1.1 cleanup-runbzr)
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: v.ladeuil+lp@free.fr-20070626203249-sqm4afiai5dxofum
Deprecate the varargs syntax and fix the tests.

* bzrlib/tests/__init__.py:
(TestCase.run_bzr): Activate the deprecation warning.
(TestCase.run_bzr_error): Add error_regexes to kwargs or run_bzr
get confused.

* bzrlib/tests/blackbox/test_selftest.py:
(TestRunBzr.test_args): Activate.

* bzrlib/tests/blackbox/test_inventory.py:
(TestInventory.assertInventoryEqual): Build the command from args
if not None.

* bzrlib/tests/blackbox/test_ls.py:
(TestLS.ls_equals): Build the command from args if not None.

* bzrlib/tests/blackbox/test_remove_tree.py:
(TestRemoveTree.test_remove_tree_lightweight_checkout_explicit):
Nice catch, we were calling run_bzr instead of run_bzr_error. This
went unnoticed for some time...

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
        register_command(cmd_echo_exact)
56
56
        try:
57
 
            self.assertEqual('foo', bzr('echo-exact', 'foo'))
 
57
            self.assertEqual('foo', bzr('echo-exact foo'))
58
58
            # This is cheating a little bit, because 'foo\xb5' shouldn't
59
59
            # get past main()
60
 
            self.assertEqual('foo\xb5', bzr('echo-exact', 'foo\xb5'))
 
60
            self.assertEqual('foo\xb5', bzr('echo-exact foo\xb5'))
61
61
            # Exact should fail to decode the string
62
 
            bzr('echo-exact', u'foo\xb5', retcode=3)
 
62
            bzr(['echo-exact', u'foo\xb5'], retcode=3)
63
63
        finally:
64
64
            plugin_cmds.pop('echo-exact')
65
65
 
70
70
 
71
71
        register_command(cmd_echo_strict)
72
72
        try:
73
 
            self.assertEqual('foo', bzr('echo-strict', 'foo'))
 
73
            self.assertEqual('foo', bzr('echo-strict foo'))
74
74
            self.assertEqual(u'foo\xb5'.encode('utf-8'),
75
 
                bzr('echo-strict', u'foo\xb5'))
 
75
                             bzr(['echo-strict', u'foo\xb5']))
76
76
        finally:
77
77
            plugin_cmds.pop('echo-strict')
78
78
 
83
83
 
84
84
        register_command(cmd_echo_strict)
85
85
        try:
86
 
            self.assertEqual('foo', bzr('echo-strict', 'foo'))
 
86
            self.assertEqual('foo', bzr('echo-strict foo'))
87
87
            # ascii can't encode \xb5
88
 
            bzr('echo-strict', u'foo\xb5', retcode=3)
 
88
            bzr(['echo-strict', u'foo\xb5'], retcode=3)
89
89
        finally:
90
90
            plugin_cmds.pop('echo-strict')
91
91
 
96
96
 
97
97
        register_command(cmd_echo_replace)
98
98
        try:
99
 
            self.assertEqual('foo', bzr('echo-replace', 'foo'))
 
99
            self.assertEqual('foo', bzr('echo-replace foo'))
100
100
            self.assertEqual(u'foo\xb5'.encode('utf-8'),
101
 
                             bzr('echo-replace', u'foo\xb5'))
 
101
                             bzr(['echo-replace', u'foo\xb5']))
102
102
        finally:
103
103
            plugin_cmds.pop('echo-replace')
104
104
 
109
109
 
110
110
        register_command(cmd_echo_replace)
111
111
        try:
112
 
            self.assertEqual('foo', bzr('echo-replace', 'foo'))
 
112
            self.assertEqual('foo', bzr('echo-replace foo'))
113
113
            # ascii can't encode \xb5
114
 
            self.assertEqual('foo?', bzr('echo-replace', u'foo\xb5'))
 
114
            self.assertEqual('foo?', bzr(['echo-replace', u'foo\xb5']))
115
115
        finally:
116
116
            plugin_cmds.pop('echo-replace')
117
117