launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #02790
Re: TestJobCronScript causing problems
On Monday, March 1, 2010, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Gavin Panella wrote:
>> LaunchpadScript, from which JobCronScriptSubclass inherits, has an
>> OptionParser that reads sys.argv. When running a script in the test
>> process, it get the arguments that were passed to bin/test.
>> LaunchpadScript.__init__() has a test_args parameter that can be used
>> to prevent use of sys.argv, and the patch adds this support to
>> JobCronScript.__init__().
>
> I'm still a little confused. Here's what I understand:
>
> We don't always run the script in a subprocess, and when we don't, we
> must override the default argument handling, because sys.argv will
> contain the parameters for the test runner, not the script.
>
> Is that what you mean?
Yes, that's it.
>
>> Sorry I didn't explain my thinking before; I was in a rush and wanted
>> to get something out there in case someone else was having a similar
>> problem.
>
> Actually, I had that problem myself, but in that specific case you can
> run it as "bin/test test_runner".
I thought I tried that without success, but perhaps I did something
else. I'll give it another go when I'm back at my computer.
Gavin.
Follow ups
References