Isn't this default a bit fragile? It would be better to declare the
default as None and then have
if time_stamp is None:
time_stamp = datetime.utcnow()
in the test, wouldn't it?
> """Test the estimated time until a builder becomes available."""
> + # Monkey-patch BuildQueueSet._now() so it returns a constant time stamp
> + # that's not too far in the future. This avoids spurious test failures.
> + monkey_patch_the_now_property(bq)
> delay = bq._estimateTimeToNextBuilder()
> test.assertTrue(
> delay <= min_time,
Hi Julian,
This branch is good to land, but I've one question:
> === modified file 'lib/lp/ soyuz/tests/ test_buildqueue .py' soyuz/tests/ test_buildqueue .py 2010-02-25 16:34:13 +0000 soyuz/tests/ test_buildqueue .py 2010-03-08 16:50:38 +0000 lastscore) to_builder( test, bq, min_time): to_builder( datetime. utcnow( )):
> --- lib/lp/
> +++ lib/lp/
> @@ -96,8 +96,12 @@
> queue_entry.
>
>
> -def check_mintime_
> +def check_mintime_
> + test, bq, min_time, time_stamp=
Isn't this default a bit fragile? It would be better to declare the
default as None and then have
if time_stamp is None:
time_stamp = datetime.utcnow()
in the test, wouldn't it?
> """Test the estimated time until a builder becomes available.""" _now() so it returns a constant time stamp patch_the_ now_property( bq) eToNextBuilder( )
> + # Monkey-patch BuildQueueSet.
> + # that's not too far in the future. This avoids spurious test failures.
> + monkey_
> delay = bq._estimateTim
> test.assertTrue(
> delay <= min_time,
Otherwise, r=me.