ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Failing Junit test only under Ant
Date Wed, 21 Nov 2001 20:30:29 GMT
I am confused here.

Fixing your unit tests to work reliably regardless of user time zone *is*
the elegant solution. The fact that your code doesnt work in all timezones
seems like a defect to me, and now that you can replicate it means that you
can fix it.

When I lived in GMT0BST there was always a tendency to mix up local and UTC
times; code written over winter would suddenly break when summer time came
along...Netscape 2.x(?) had a similar defect surface one year. You are
lucky, your tests show it...now it is time to fix it.

-steve

----- Original Message -----
From: <otisg@ivillage.com>
To: <ant-user@jakarta.apache.org>
Sent: Wednesday, November 21, 2001 11:45
Subject: Re: Failing Junit test only under Ant


> Hello,
>
> Does anyone know if there is a more elegant solution to this problem?
> I thought of doing this, but I was hoping there is a better, more
programmatic perhaps, way of doing this.
>
> Thanks,
> Otis
>
>
>
> On Sat, 10 November 2001, "Steve Loughran" wrote:
>
> >
> > As a short term hack why not add the unset command to ANT.bat or ant.sh
(for
> > the latter you can put it in ~/.antrc).
> >
> > Better would be to fix your junit test case so that it works regardless
of
> > the TZ of the user.
> >
> > ----- Original Message -----
> > From: <otisg@ivillage.com>
> > To: <ant-user@jakarta.apache.org>
> > Sent: Saturday, November 10, 2001 1:01 PM
> > Subject: Failing Junit test only under Ant
> >
> >
> > > Hello,
> > >
> > > I have a unit test that uses Junit and deals with Dates.
> > > All Date operations are done in UTC time zone, so that is what Junit
tests
> > expect.
> > > I have my environment variable TZ set to EST5EDT.
> > >
> > > When I run the unit test from the command line all tests pass.
> > >
> > > When I run the unit test from Ant it fails because all time values are
off
> > by 5 hours (UTC is 5 hours ahead of my time zone).
> > >
> > > Has anyone encountered this?
> > > Does anyone have a solution?
> > >
> > > My solution was to unset my TZ environment variable.
> > > As soon as I did that the tests started running fine even from Ant.
> > >
> > > However, I don't quite like that solution as it forces my to modify my
> > environment in order to let the tests pass when I run them under Ant.
Now
> > `date` gives me time in GMT :(
> > >
> > > I would prefer it if I could do something within Ant to prevent it
from
> > looking at my TZ.
> > > I tried fooling Ant like this:
> > >
> > > <property name="env.TZ" value="UTC"/>
> > >
> > > However, that had no effect on the outcome.
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > > Otis
> > >
> > > _________________________________________________________________
> > > iVillage.com: Solutions for Your Life
> > > Check out the most exciting women's community on the Web
> > > http://www.ivillage.com
> > >
> > > --
> > > To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
>
> _________________________________________________________________
> iVillage.com: Solutions for Your Life
> Check out the most exciting women's community on the Web
> http://www.ivillage.com
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message