Support 'built-in' datetime module

Some distributions (Ubuntu >= 14.10) build the datetime module
directly into the python interpreter; update tests to ensure that
this is detected correctly.

Change-Id: I67ebd2a29e695417fda0334952427fcf550738f2
Closes-Bug: 1369460
This commit is contained in:
James Page 2014-09-15 10:07:26 +01:00
parent 80fec894a5
commit 0929bdee1a

View File

@ -221,7 +221,8 @@ class ToPrimitiveTestCase(test_base.BaseTestCase):
x = [datetime, foo, dir]
ret = jsonutils.to_primitive(x)
self.assertEqual(len(ret), 3)
self.assertTrue(ret[0].startswith(u"<module 'datetime' from "))
self.assertTrue(ret[0].startswith(u"<module 'datetime' from ") or
ret[0].startswith(u"<module 'datetime' (built-in)"))
if six.PY3:
self.assertTrue(ret[1].startswith(
'<function ToPrimitiveTestCase.test_nasties.<locals>.foo at 0x'