Skip utils_test if timelib is not installed (#32699)

date_cast() throws a RuntimeError, not an ImportError
This commit is contained in:
Eric Radman 2016-04-20 16:01:21 -04:00 committed by Pablo Suárez Hernández
parent d1b9a4061e
commit 5977f1f54c

View File

@ -527,14 +527,9 @@ class UtilsTestCase(TestCase):
ret = utils.date_cast('Mon Dec 23 10:19:15 MST 2013')
expected_ret = datetime.datetime(2013, 12, 23, 10, 19, 15)
self.assertEqual(ret, expected_ret)
except ImportError:
try:
ret = utils.date_cast('Mon Dec 23 10:19:15 MST 2013')
expected_ret = datetime.datetime(2013, 12, 23, 10, 19, 15)
self.assertEqual(ret, expected_ret)
except RuntimeError:
# Unparseable without timelib installed
self.skipTest('\'timelib\' is not installed')
except RuntimeError:
# Unparseable without timelib installed
self.skipTest('\'timelib\' is not installed')
@skipIf(not HAS_TIMELIB, '\'timelib\' is not installed')
def test_date_format(self):