[MERGE] Before actually using encoding need to check that Python has corresponding codec (v.2)

Alexander Belchenko bialix at ukr.net
Tue Dec 26 15:46:01 GMT 2006


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

Aaron Bentley пишет:
> Aaron Bentley has voted +1 (conditional).
> Status is now: Conditionally approved
> Comment:
> This seems reasonable, but lacks a test case.  It seems to me that it would be easy to write one.  Am I wrong about that?

Here new version of my patch with tests.

1) I create special class to fake non-existed encodings, used in our tests
2) I move encoding tests to test_osutils_encodings.py
3) For testing get_user_encoding() function I add special argument
   to disable usual caching (otherwise I cannot check all code paths).


D:\Bazaar\sandbox\check-encoding>python bzr --no-plugins selftest test_osutils_encoding -v
       bzr: D:/Bazaar/sandbox/check-encoding/bzr
    bzrlib: D:\Bazaar\sandbox\check-encoding\bzrlib

running 7 tests...
test_osutils_encodings.TestFakeCodec.test_fake_codec                                                 OK
  9ms
test_osutils_encodings.TestTerminalEncoding.test_get_terminal_encoding                               OK
 29ms
test_osutils_encodings.TestTerminalEncoding.test_terminal_cp0                                        OK
  0ms
test_osutils_encodings.TestTerminalEncoding.test_terminal_cpUNKNOWN                                  OK
  9ms
test_osutils_encodings.TestUserEncoding.test_get_user_encoding                                       OK
  0ms
test_osutils_encodings.TestUserEncoding.test_user_cp0                                                OK
  0ms
test_osutils_encodings.TestUserEncoding.test_user_cpUNKNOWN                                          OK
  0ms

- ----------------------------------------------------------------------
Ran 7 tests in 0.110s

OK
tests passed


Alexander

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

iD8DBQFFkUO5zYr338mxwCURAuKQAKCXUWS8oQvZtUb4334NH3uwJM9XowCfZp0p
16iyKwXGsnv7dNkTY5QsNHo=
=MwPA
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check-encoding.v2.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20061226/1daebf1a/attachment.diff 


More information about the bazaar mailing list