set timezone to US/Eastern when test_build_notification executing

following PR#628
This commit is contained in:
Yuming Zhu 2017-10-11 15:27:43 +00:00 committed by Mike McLean
parent ff396155f2
commit 659a63a167

View file

@ -51,6 +51,8 @@ class MyClientSession(koji.ClientSession):
class TestBuildNotification(unittest.TestCase):
def setUp(self):
self.original_timezone = os.environ.get('TZ')
os.environ['TZ'] = 'US/Eastern'
self.tempdir = tempfile.mkdtemp()
self.SMTP = mock.patch('smtplib.SMTP').start()
self.session = mock.MagicMock()
@ -59,6 +61,10 @@ class TestBuildNotification(unittest.TestCase):
self.options.workdir = self.tempdir
def tearDown(self):
if self.original_timezone is None:
del os.environ['TZ']
else:
os.environ['TZ'] = self.original_timezone
mock.patch.stopall()
def test_build_notification(self):