Skip to content

Commit

Permalink
remove path logic
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Jun 17, 2024
1 parent 2ec8baf commit aef3c30
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions dbt_common/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit aef3c30

Please sign in to comment.