Skip to content

Commit

Permalink
Merge pull request #1027 from prescod/prescod/warning-fixups
Browse files Browse the repository at this point in the history
Clean up warnings in tests and at runtime.
  • Loading branch information
jstvz authored Apr 8, 2024
2 parents c148699 + 97a756f commit c3b64ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion snowfakery/data_generator_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def __exit__(self, *args):
try:
plugin.close()
except Exception as e:
warn(f"Could not close {plugin} because {e}")
warn(f"Could not close {plugin} because {repr(e)}")
self.current_context = None
self.plugin_instances = None
self.plugin_function_libraries = None
Expand Down
4 changes: 2 additions & 2 deletions snowfakery/standard_plugins/Schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _process_special_cases(
add_date = self.ruleset.rdate
else: # pragma: no cover - Should be unreachable
assert action in ("include", "exclude"), "Bad action!"
raise NotImplementedError()
raise NotImplementedError("Bad action!")

if isinstance(case, (list, tuple)):
for case in case:
Expand Down Expand Up @@ -338,7 +338,7 @@ def next(self) -> None: # pragma: no cover
"""This method is never called.
It is replaced at runtime by _next_datetime or _next_date"""
raise NotImplementedError()
raise NotImplementedError("next is not implemented")

def _next_datetime(self) -> datetime:
return next(self.iterator)
Expand Down
8 changes: 6 additions & 2 deletions snowfakery/standard_plugins/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ def _get_dataset_instance(self, plugin_context, iteration_mode, kwargs):
return dataset_instance

def _load_dataset(self, iteration_mode, rootpath, kwargs):
raise NotImplementedError()
raise NotImplementedError("_load_dataset not implemented")

def close(self):
raise NotImplementedError()
raise NotImplementedError("close not implemented: " + repr(self))


class FileDataset(DatasetBase):

def close(self):
pass

def _load_dataset(self, iteration_mode, rootpath, kwargs):
dataset = kwargs.get("dataset")
tablename = kwargs.get("table")
Expand Down

0 comments on commit c3b64ee

Please sign in to comment.