fix timezone in test_list_tagged
This commit is contained in:
parent
777fdeba28
commit
d70f22ee1b
2 changed files with 17 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ try:
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import unittest
|
import unittest
|
||||||
|
import time
|
||||||
|
|
||||||
import koji
|
import koji
|
||||||
import koji.util
|
import koji.util
|
||||||
from .loadkojid import kojid
|
from .loadkojid import kojid
|
||||||
|
|
@ -55,6 +57,7 @@ class TestBuildNotification(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.original_timezone = os.environ.get('TZ')
|
self.original_timezone = os.environ.get('TZ')
|
||||||
os.environ['TZ'] = 'US/Eastern'
|
os.environ['TZ'] = 'US/Eastern'
|
||||||
|
time.tzset()
|
||||||
self.tempdir = tempfile.mkdtemp()
|
self.tempdir = tempfile.mkdtemp()
|
||||||
self.SMTP = mock.patch('smtplib.SMTP').start()
|
self.SMTP = mock.patch('smtplib.SMTP').start()
|
||||||
self.session = mock.MagicMock()
|
self.session = mock.MagicMock()
|
||||||
|
|
@ -67,6 +70,7 @@ class TestBuildNotification(unittest.TestCase):
|
||||||
del os.environ['TZ']
|
del os.environ['TZ']
|
||||||
else:
|
else:
|
||||||
os.environ['TZ'] = self.original_timezone
|
os.environ['TZ'] = self.original_timezone
|
||||||
|
time.tzset()
|
||||||
mock.patch.stopall()
|
mock.patch.stopall()
|
||||||
|
|
||||||
def test_build_notification(self):
|
def test_build_notification(self):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
|
@ -11,6 +13,9 @@ class TestCliListTagged(utils.CliTestCase):
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self.original_timezone = os.environ.get('TZ')
|
||||||
|
os.environ['TZ'] = 'US/Eastern'
|
||||||
|
time.tzset()
|
||||||
self.error_format = """Usage: %s list-tagged [options] tag [package]
|
self.error_format = """Usage: %s list-tagged [options] tag [package]
|
||||||
(Specify the --help global option for a list of other help options)
|
(Specify the --help global option for a list of other help options)
|
||||||
|
|
||||||
|
|
@ -48,6 +53,13 @@ class TestCliListTagged(utils.CliTestCase):
|
||||||
'tag_name': 'tag',
|
'tag_name': 'tag',
|
||||||
'owner_name': 'owner'}]
|
'owner_name': 'owner'}]
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
if self.original_timezone is None:
|
||||||
|
del os.environ['TZ']
|
||||||
|
else:
|
||||||
|
os.environ['TZ'] = self.original_timezone
|
||||||
|
time.tzset()
|
||||||
|
|
||||||
@mock.patch('koji.util.eventFromOpts', return_value={'id': 1000,
|
@mock.patch('koji.util.eventFromOpts', return_value={'id': 1000,
|
||||||
'ts': 1000000.11})
|
'ts': 1000000.11})
|
||||||
@mock.patch('koji_cli.commands.activate_session')
|
@mock.patch('koji_cli.commands.activate_session')
|
||||||
|
|
@ -66,7 +78,7 @@ class TestCliListTagged(utils.CliTestCase):
|
||||||
package='pkg')
|
package='pkg')
|
||||||
self.session.listTaggedRPMS.assert_not_called()
|
self.session.listTaggedRPMS.assert_not_called()
|
||||||
self.assert_console_message(sys.stdout,
|
self.assert_console_message(sys.stdout,
|
||||||
'Querying at event 1000 (Mon Jan 12 13:46:40 1970)\n'
|
'Querying at event 1000 (Mon Jan 12 08:46:40 1970)\n'
|
||||||
'Build Tag Built by\n'
|
'Build Tag Built by\n'
|
||||||
'---------------------------------------- -------------------- ----------------\n'
|
'---------------------------------------- -------------------- ----------------\n'
|
||||||
'n-v-r tag owner\n')
|
'n-v-r tag owner\n')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue