title: Daylight savings time change affecting the outcome of saving and loading an icalendar file?
body: <p>I have some unit tests that started failing today after a switch in daylight savings time.</p>
  
  <p>We're using the <a href="http://codespeak.net/icalendar/" rel="nofollow noreferrer">iCalendar python module</a> to load and save ics files.</p>
  
  <p>The following script is a simplified version of our test.  The script works fine in 'summer' and fails in 'winter', as of this morning.  The failure can be reproduced by setting the clock back manually.  Here's the output of the script:</p>
  
  <pre><code>[root@ana icalendar]# date 10250855
  Sat Oct 25 08:55:00 CEST 2008
  [root@ana icalendar]# python dst.py
  DTSTART should represent datetime.datetime(2015, 4, 4, 8, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Brussels')) Brussels time
  DTSTART should represent datetime.datetime(2015, 4, 4, 6, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x956b5cc&gt;) UTC
  DTSTART represents datetime.datetime(2015, 4, 4, 6, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x956b5cc&gt;) Brussels time
  [root@ana icalendar]# date 10260855
  Sun Oct 26 08:55:00 CET 2008
  [root@ana icalendar]# python dst.py
  DTSTART should represent datetime.datetime(2015, 4, 4, 8, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Brussels')) Brussels time
  DTSTART should represent datetime.datetime(2015, 4, 4, 6, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x96615cc&gt;) UTC
  DTSTART represents datetime.datetime(2015, 4, 4, 7, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x96615cc&gt;) Brussels time
  Traceback (most recent call last):
    File "dst.py", line 58, in &lt;module&gt;
      start.dt, startUTCExpected)
  AssertionError: calendar's datetime.datetime(2015, 4, 4, 7, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x96615cc&gt;) != expected datetime.datetime(2015, 4, 4, 6, 0, tzinfo=&lt;icalendar.prop.UTC object at 0x96615cc&gt;)
  </code></pre>
  
  <p>And here is the <a href="https://thomas.apestaart.org/thomas/trac/browser/tests/icalendar/dst.py" rel="nofollow noreferrer">whole script</a>.</p>
  
  <p>So, questions:
   - why would my current time (and which part of DST I'm in) affect the loading/saving/parsing of timestamps ? I would expect it not to.
   - how would you unit test this kind of bug, if it is a bug ? Obviously, I don't want my unit tests to reset the clock on my computer.</p>