Commit 35969925 authored by Arnaud Fontaine's avatar Arnaud Fontaine

squash! ERP5Type.tests.utils: introduce timeZoneContext

parent 5a74db87
...@@ -31,12 +31,6 @@ from unittest import expectedFailure ...@@ -31,12 +31,6 @@ from unittest import expectedFailure
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime from DateTime import DateTime
# explicitly set Europe/Paris timezone
os.environ['TZ']='Europe/Paris'
time.tzset()
DateTime._localzone0 = 'GMT+1'
DateTime._localzone1 = 'GMT+2'
DateTime._multipleZones = True
class TestOpenOrder(ERP5TypeTestCase): class TestOpenOrder(ERP5TypeTestCase):
""" """
...@@ -47,6 +41,11 @@ class TestOpenOrder(ERP5TypeTestCase): ...@@ -47,6 +41,11 @@ class TestOpenOrder(ERP5TypeTestCase):
return 'Test Open Order' return 'Test Open Order'
def afterSetUp(self): def afterSetUp(self):
from Products.ERP5Type.tests.utils import timeZoneContext
timezone = timeZoneContext('Europe/Paris')
timezone.__enter__()
self.addCleanup(timezone.__exit__, None, None, None)
if getattr(self.portal, '_run_after_setup', None) is not None: if getattr(self.portal, '_run_after_setup', None) is not None:
return return
......
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