Commit f14e5ad2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use DateTime(str(DateTime().earliestTime() + gap)) instead of

(DateTime().earliestTime() + gap).earliestTime(), since
DateTime().__add__() returns a different tz offset if daylight saving
changes.

For example (timezone is Europe/Paris):

>>> DateTime().earliestTime()
DateTime('2008/10/24')
>>> DateTime().earliestTime()._tz
'GMT+2'
>>> (DateTime().earliestTime()+10)
DateTime('2008/11/03')
>>> (DateTime().earliestTime()+10)._tz
'GMT+2'
>>> DateTime(str((DateTime().earliestTime()+10)))
DateTime('2008/11/03')
>>> DateTime(str((DateTime().earliestTime()+10)))._tz
'GMT+1'


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24312 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 65285cec
......@@ -30,6 +30,7 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.CMFCore.utils import getToolByName
......@@ -390,11 +391,11 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
if not run: return
self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_start_date = DateTime(
str(self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff))
self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.wanted_start_date
sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string)
......@@ -424,11 +425,11 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
'
self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_start_date = DateTime(
str(self.datetime.earliestTime() + \
self.order_builder_hardcoded_time_diff))
self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.wanted_start_date
self.decrease_quantity_matrix = {
'size/Man' : 1.0,
......@@ -450,12 +451,14 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.max_delay = 14.0
self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \
- self.max_delay \
+ self.order_builder_hardcoded_time_diff
self.wanted_start_date = DateTime(
str(self.datetime.earliestTime() \
- self.max_delay \
+ self.order_builder_hardcoded_time_diff))
self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_stop_date = DateTime(
str(self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff))
sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string)
......@@ -468,11 +471,11 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
if not run: return
self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_start_date = DateTime(
str(self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff))
self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.wanted_start_date
sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment