MCPcopy Create free account
hub / github.com/apache/impala / get_instance

Method get_instance

tests/common/environ.py:284–295  ·  view source on GitHub ↗

Implements lazy initialization of a singleton instance of this class. We cannot initialize the instances when this module is imported because some dependencies may not be available yet, e.g. the pytest config object. Thus we instead initialize it the first time that a test needs it.

(cls, pytest_config=None)

Source from the content-addressed store, hash-verified

282
283 @classmethod
284 def get_instance(cls, pytest_config=None):
285 """Implements lazy initialization of a singleton instance of this class. We cannot
286 initialize the instances when this module is imported because some dependencies may
287 not be available yet, e.g. the pytest config object. Thus we instead initialize it
288 the first time that a test needs it."""
289 if cls._instance is not None:
290 return cls._instance
291
292 assert pytest_config is not None, (
293 "Initial pytest_config must be provided for singleton")
294 cls._instance = cls.create_new_instance(pytest_config)
295 return cls._instance
296
297 @property
298 def build_flavor(self):

Callers 15

pytest_configureFunction · 0.80
cluster_propertiesFunction · 0.80
test_large_sqlMethod · 0.80
test_kudu.pyFile · 0.80
test_spilling.pyFile · 0.80
get_kudu_master_webpageFunction · 0.80

Calls 1

create_new_instanceMethod · 0.80