@@ -42,7 +42,9 @@ def _get_manager_fixture_line_str() -> str:
4242 """Get `filename#lineno` of current fixture, called from contextmanager."""
4343 # Get past `cache_fixture` and `contextmanager` to the fixture
4444 calling_frame = inspect .currentframe ().f_back .f_back .f_back # type: ignore
45- assert calling_frame
45+ if not calling_frame :
46+ msg = "Couldn't get the calling frame."
47+ raise ValueError (msg )
4648 return helpers .get_line_str_from_frame (frame = calling_frame )
4749
4850
@@ -282,7 +284,7 @@ def _get_resources_from_paths(
282284 ) -> list [str ]:
283285 if from_set is not None and isinstance (from_set , str ):
284286 msg = "`from_set` cannot be a string"
285- raise AssertionError (msg )
287+ raise TypeError (msg )
286288
287289 resources = set (status_files .get_resources_from_path (paths = paths ))
288290
@@ -383,7 +385,7 @@ def init(
383385 cluster_obj = self .cache .cluster_obj
384386 if not cluster_obj :
385387 msg = "`cluster_obj` not available, that cannot happen"
386- raise AssertionError (msg )
388+ raise RuntimeError (msg )
387389 cluster_obj .cluster_id = self .cluster_instance_num
388390 cluster_obj ._cluster_manager = self # type: ignore
389391 self ._initialized = True
@@ -408,8 +410,8 @@ def get(
408410 # If you've ran into this issue, check that all the fixtures you use in the test are using
409411 # the same `cluster` fixture.
410412 if check_initialized and self ._initialized :
411- msg = "manager is already initialized"
412- raise AssertionError (msg )
413+ msg = "Manager is already initialized"
414+ raise RuntimeError (msg )
413415
414416 self .init (
415417 mark = mark ,
@@ -421,5 +423,7 @@ def get(
421423 )
422424
423425 cluster_obj = self .cache .cluster_obj
424- assert cluster_obj
426+ if not cluster_obj :
427+ msg = "`cluster_obj` not available, that cannot happen"
428+ raise RuntimeError (msg )
425429 return cluster_obj
0 commit comments