[MERGE] fixes for TestCase.run_bzr* methods

Alexander Belchenko bialix at ukr.net
Tue Sep 25 08:23:27 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool пишет:
> Martin Pool has voted tweak.
> Status is now: Conditionally approved
> Comment:
> 
> 
> === modified file 'bzrlib/tests/__init__.py'
> --- bzrlib/tests/__init__.py    2007-09-13 01:54:49 +0000
> +++ bzrlib/tests/__init__.py    2007-09-21 13:07:41 +0000
> @@ -1320,7 +1320,9 @@
>              working_dir):
>          """Run bazaar command line, splitting up a string command line."""
>          if isinstance(args, basestring):
> -            args = list(shlex.split(args))
> +            # shlex don't understand unicode strings,
> +            # so args should be plain string (bialix 20070906)
> +            args = list(shlex.split(str(args)))
>          return self._run_bzr_core(args, retcode=retcode,
>                  encoding=encoding, stdin=stdin, working_dir=working_dir,
>                  )
> 
> The vast majority of tests pass plain byte strings to run_bzr, so will
> be unaffected by this change.
> 
> I guess there must be some that do pass unicode otherwise you wouldn't
> need to test this. :-)  At the moment they end up with an array of
> unicode characters passed through to the cmd object; with this change
> the cmd object will get an array of default-encoded byte strings.  That
> may be fine, but I'm not totally sure that those tests will still be
> fully effective with that change, because I don't know what they're
> trying to test.
> 
> So maybe it would be better for this method to insist that if there is
> autosplitting, the string must be just a byte string?  If you want to
> pass unicode, the caller should split it?
> 
> Or if you're satisfied that the tests changed by this are not ones that
> care about how the cmd object is called, then this is probably ok.

Here is failing test:

======================================================================
FAIL: test_push_dash_d (bzrlib.tests.blackbox.test_push.TestPush)

vvvv[log from bzrlib.tests.blackbox.test_push.TestPush.test_push_dash_d]------
created control directory in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from/
creating repository in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from/.bzr/.
creating branch <bzrlib.branch.BzrBranchFormat6 object at 0x05CA7190> in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from/.bzr/
trying to create missing lock
'C:/docume~1/modul/locals~1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from/.bzr/checkout/dirstate'
opening working tree 'C:/docume~1/modul/locals~1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from'
preparing to commit
Selecting files for commit with filter None
added revision_id {modul98 at home-20070905125348-e91gq9645vzwcnwz}
run bzr: ['push', '-d', 'from', 'to-one']
bzr arguments: ['push', '-d', 'from', 'to-one']
encoding stdout as sys.stdout encoding 'cp1251'
created control directory in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one/
creating repository in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one/.bzr/.
Using fetch logic to copy between
KnitRepository(u'file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from/.bzr/')(<RepositoryFormatKnit1>)
and
KnitRepository(u'file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one/.bzr/')(<RepositoryFormatKnit1>)
fetch up to rev {modul98 at home-20070905125348-e91gq9645vzwcnwz}
creating branch <bzrlib.branch.BzrBranchFormat6 object at 0x011D3D70> in
file:///C:/docume%7E1/modul/locals%7E1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one/.bzr/
opening working tree 'C:/docume~1/modul/locals~1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/from'
trying to create missing lock
'C:/docume~1/modul/locals~1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one/.bzr/checkout/dirstate'
opening working tree 'C:/docume~1/modul/locals~1/temp/testbzr-ta5exi.tmp/tmpx-nykd/work/to-one'
    INFO  Created new branch.
errors:
'Created new branch.\n'
run bzr: ['p\x00u\x00s\x00h\x00', '\x00-\x00d\x00',
'\x00f\x00i\x00l\x00e\x00:\x00/\x00/\x00/\x00C\x00:\x00/\x00d\x00o\x00c\x00u\x00m\x00e\x00%\x007\x00E\x001\x00/\x00m\x00o\x00d\x00u\x00l\x00/\x00l\x00o\x00c\x00a\x00l\x00s\x00%\x007\x00E\x001\x00/\x00t\x00e\x00m\x00p\x00/\x00t\x00e\x00s\x00t\x00b\x00z\x00r\x00-\x00t\x00a\x005\x00e\x00x\x00i\x00.\x00t\x00m\x00p\x00/\x00t\x00m\x00p\x00x\x00-\x00n\x00y\x00k\x00d\x00/\x00w\x00o\x00r\x00k\x00/\x00f\x00r\x00o\x00m\x00',
'\x00f\x00i\x00l\x00e\x00:\x00/\x00/\x00/\x00C\x00:\x00/\x00d\x00o\x00c\x00u\x00m\x00e\x00%\x007\x00E\x001\x00/\x00m\x00o\x00d\x00u\x00l\x00/\x00l\x00o\x00c\x00a\x00l\x00s\x00%\x007\x00E\x001\x00/\x00t\x00e\x00m\x00p\x00/\x00t\x00e\x00s\x00t\x00b\x00z\x00r\x00-\x00t\x00a\x005\x00e\x00x\x00i\x00.\x00t\x00m\x00p\x00/\x00t\x00m\x00p\x00x\x00-\x00n\x00y\x00k\x00d\x00/\x00w\x00o\x00r\x00k\x00/\x00t\x00o\x00-\x00t\x00w\x00o\x00']
bzr arguments: ['p\x00u\x00s\x00h\x00', '\x00-\x00d\x00',
'\x00f\x00i\x00l\x00e\x00:\x00/\x00/\x00/\x00C\x00:\x00/\x00d\x00o\x00c\x00u\x00m\x00e\x00%\x007\x00E\x001\x00/\x00m\x00o\x00d\x00u\x00l\x00/\x00l\x00o\x00c\x00a\x00l\x00s\x00%\x007\x00E\x001\x00/\x00t\x00e\x00m\x00p\x00/\x00t\x00e\x00s\x00t\x00b\x00z\x00r\x00-\x00t\x00a\x005\x00e\x00x\x00i\x00.\x00t\x00m\x00p\x00/\x00t\x00m\x00p\x00x\x00-\x00n\x00y\x00k\x00d\x00/\x00w\x00o\x00r\x00k\x00/\x00f\x00r\x00o\x00m\x00',
'\x00f\x00i\x00l\x00e\x00:\x00/\x00/\x00/\x00C\x00:\x00/\x00d\x00o\x00c\x00u\x00m\x00e\x00%\x007\x00E\x001\x00/\x00m\x00o\x00d\x00u\x00l\x00/\x00l\x00o\x00c\x00a\x00l\x00s\x00%\x007\x00E\x001\x00/\x00t\x00e\x00m\x00p\x00/\x00t\x00e\x00s\x00t\x00b\x00z\x00r\x00-\x00t\x00a\x005\x00e\x00x\x00i\x00.\x00t\x00m\x00p\x00/\x00t\x00m\x00p\x00x\x00-\x00n\x00y\x00k\x00d\x00/\x00w\x00o\x00r\x00k\x00/\x00t\x00o\x00-\x00t\x00w\x00o\x00']
Traceback (most recent call last):
  File "C:\work\Bazaar\bzr.dev\bzrlib\commands.py", line 801, in run_bzr_catch_errors
    return run_bzr(argv)
  File "C:\work\Bazaar\bzr.dev\bzrlib\commands.py", line 749, in run_bzr
    cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
  File "C:\work\Bazaar\bzr.dev\bzrlib\commands.py", line 144, in get_cmd_object
    raise errors.BzrCommandError('unknown command "%s"' % cmd_name)
BzrCommandError: unknown command "p u s h "

errors:
'bzr: ERROR: unknown command "p\x00u\x00s\x00h\x00"\n'

^^^^[log from bzrlib.tests.blackbox.test_push.TestPush.test_push_dash_d]------
- ----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\work\Bazaar\bzr.dev\bzrlib\tests\blackbox\test_push.py", line 175, in test_push_dash_d
    % tuple(map(urlutils.local_path_to_url, ['from', 'to-two'])))
AssertionError: Unexpected return code
not equal:
a = 0
b = 3



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG+LdvzYr338mxwCURAqQcAJ9wAZklnFPlig5WBXR7nyPS9qpuegCfV1cN
li1UyWNLKz2km/9OZC0esIM=
=uja6
-----END PGP SIGNATURE-----



More information about the bazaar mailing list