From aef3c30214ff6bad61ad2ed4067330313dd6aa84 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Mon, 17 Jun 2024 10:47:29 -0500 Subject: [PATCH] remove path logic --- dbt_common/record.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dbt_common/record.py b/dbt_common/record.py index 12ea26ed..ac2838d5 100644 --- a/dbt_common/record.py +++ b/dbt_common/record.py @@ -205,8 +205,6 @@ def __init__( self.diff: Diff self.previous_recording_path = previous_recording_path self.current_recording_path = current_recording_path - self.dir_path = os.path.join(os.path.dirname(self.current_recording_path), "recordings") - os.makedirs(self.dir_path, exist_ok=True) # Create the directory if it does not exist # TODO: better way to do this? if self.previous_recording_path is not None and self.mode == RecorderMode.REPLAY: @@ -247,8 +245,7 @@ def pop_matching_record(self, params: Any) -> Optional[Record]: return match def write(self) -> None: - fp = os.path.join(self.dir_path, os.path.basename(self.current_recording_path)) - with open(fp, "w") as file: + with open(self.current_recording_path, "w") as file: json.dump(self._to_dict(), file) def _to_dict(self) -> Dict: @@ -288,10 +285,9 @@ def expect_record(self, params: Any) -> Any: return result_tuple[0] if len(result_tuple) == 1 else result_tuple def write_diffs(self, diff_file_name) -> None: - fp = os.path.join(self.dir_path, os.path.basename(diff_file_name)) json.dump( self.diff.calculate_diff(), - open(fp, "w"), + open(diff_file_name, "w"), ) def print_diffs(self) -> None: