[RFC] fake editor for testing edit_commit_message

Alexander Belchenko bialix at ukr.net
Wed Jan 4 23:11:08 GMT 2006


I'm a little working on tests for encoding bugs. This is somewhat 
difficult because often things crash because UnicodeEncodeDecode errors 
raised in mutter or other part of logging subsystem. But another problem 
is to write test for committing with message edited in external editor.

I was trying override BZR_EDITOR environment variable with some fake 
editor that simply insert at the begging of file with edited message a 
line like this: "test message from fed".

When I was trying to use python script (see attachment: fed.py) as fake 
editor and set:

set BZR_EDITOR="python fed.py"

I've got WindowsError in subprocess.py when I'm trying to do commit. I 
don't understand why. Fully qualfied path to script also does not help. :-(

I'm give up and write simple equivalent C-program. See attachment: fed.c 
(and simple SConstruct for building with SCons). This one works fine and 
as expected. So I guess it can be used for testing.

I hope this program written in enough portable way to easily compiling 
on *nix/Cygwin (and probably Mac?).

I have some questions:

1) Is this `fed` is appropriate for using as part of selftest for 
testing bzrlib/msgeditor.py::edit_commit_message() function?

2) Where executable binary should be placed? In what directory of 
bzr.dev tree? Probably in bzr.dev/tools subdir?

3) For building executable binary users must have appropriate compiler 
on their machines. On Windows (and on Cygwin in minimalistic 
installation too) users may have no one compiler installed (even some 
free compiler) on their machines. So I think we should include at least 
windows-exe file in release package for Windows. What you think about?

4) When running test that defined in class derived from 
TestCaseInTempDir current dir switched to created for test. What the 
simpliest way to obtain location where our helper utility reside?

Alexander
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SConstruct
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060105/6117ec3f/attachment.diff 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fed.py
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060105/6117ec3f/attachment-0001.diff 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fed.c
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060105/6117ec3f/attachment-0002.diff 


More information about the bazaar mailing list