capture exc_info early in keyspace meta handling

Resolves an issue where exc_info is being cleared in nosetest context,
causing tests to fail.
This commit is contained in:
Adam Holmberg
2015-11-25 14:34:20 -06:00
parent bbba912a88
commit 1e857176e4
2 changed files with 2 additions and 3 deletions

View File

@@ -1708,9 +1708,9 @@ class SchemaParserV22(_SchemaParser):
ksm = cls._build_keyspace_metadata_internal(row)
except Exception:
name = row["keyspace_name"]
log.exception("Error while parsing metadata for keyspace %s row(%s)", name, row)
ksm = KeyspaceMetadata(name, False, 'UNKNOWN', {})
ksm._exc_info = sys.exc_info()
ksm._exc_info = sys.exc_info() # capture exc_info before log because nose (test) logging clears it in certain circumstances
log.exception("Error while parsing metadata for keyspace %s row(%s)", name, row)
return ksm
@staticmethod

View File

@@ -1907,7 +1907,6 @@ class BadMetaTest(unittest.TestCase):
if CASS_SERVER_VERSION < version:
raise unittest.SkipTest("Requires server version >= %s" % (version,))
@notcython
def test_bad_keyspace(self):
with patch.object(self.parser_class, '_build_keyspace_metadata_internal', side_effect=self.BadMetaException):
self.cluster.refresh_keyspace_metadata(self.keyspace_name)