python version-specific codepaths in tests

John Arbash Meinel john at
Fri Nov 20 15:17:14 GMT 2009

Hash: SHA1

Gordon Tyler wrote:
> John Arbash Meinel wrote:
>> I would make sure it works first. If SIGTERM is built on
>> TerminateProcess, I think it works, but I'd want to make sure it doesn't
>> kill the testing process.
> I've been using it this evening while adding a test for bzr serve. All
> the bzr serve tests seem to work fine on win32. Haven't tested it on
> non-win32 yet.
> There is a wee snag though: the tests which make use of
> finish_bzr_subprocess' signalling capability use SIGINT, to simulate a
> user pressing Ctrl-C I'm guessing. The Win32 implementation of
> Popen.send_signal only allows SIGTERM. I could make it translate SIGINT
> to SIGTERM but that changes bzr's output (no 'bzr: interrupted'). I'm
> wondering if it's important enough to simulate user interruption in
> those cases or if it's acceptable to use SIGTERM in those tests instead.
> The code which uses SIGINT:
> TestActuallyStartBzrSubprocess
> - test_start_and_stop_bzr_subprocess_send_signal
> TestBzrServe
> - assertServerFinishesCleanly (which is used by most of the actual tests
> in TestBzrServe)
> Ciao,
> Gordon

so you can replicate SIGINT, but when I was digging through the win32
api docs, it basically sends a ^C to the console. Which means that either:

1) You interrupt the current process as well as the subprocess
2) You spawn the subprocess into a separate process group/etc in which
case you can no longer send it SIGINT...

Joy, right? </sarcasm>

Anyway, (1) can be handled by trapping KeyboardInterrupt around the
send-signal code.

I'll attach the script I used for testing this a while ago.

We probably could turn this into a '' helper, and use it as
long as ctypes is present (the code I have is using pywin32, but it is
usually pretty easy to convert into a ctypes helper.)

As for whether SIGINT is *needed*... It is nice to see that things clean
up cleanly and quietly. It isn't a strict requirement.

Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla -

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...

More information about the bazaar mailing list