Skip to content

Commit

Permalink
fix memory viz arguments not being correctly passed and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
leowrites committed Sep 23, 2024
1 parent aaace6e commit eabb2b5
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 65 deletions.
10 changes: 5 additions & 5 deletions python_ta/debug/snapshot_manager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

import inspect
import json
import os
import shutil
import subprocess
import sys
import types
from typing import Any, List, Optional
Expand Down Expand Up @@ -33,14 +32,15 @@ def __init__(

def _trace_func(self, frame: types.FrameType, event: str, _arg: Any) -> None:
if event == "line" and frame.f_locals:
memory_viz_args_copy = self.memory_viz_args.copy()
if self.output_filepath:
self.memory_viz_args.extend(
memory_viz_args_copy.extend(
[
"--output",
os.path.join(self.output_filepath, f"snapshot-{self.snapshot_counts}.svg"),
]
)
snapshot(include=self.include, save=True, memory_viz_args=self.memory_viz_args)
snapshot(include=self.include, save=True, memory_viz_args=memory_viz_args_copy)
self.snapshot_counts += 1

def get_snapshot_count(self):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions tests/test_debug/test_snapshot_manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os.path
import shutil

Expand Down Expand Up @@ -63,10 +65,7 @@ def assert_output_files_match(snapshot_count: int, output_path: str, expected_pa
for i in range(snapshot_count):
actual_file = os.path.join(output_path, f"snapshot-{i}.svg")
expected_file = os.path.join(expected_path, f"snapshot-{i}.svg")
with (
open(actual_file) as actual_file,
open(expected_file) as expected_file,
):
with open(actual_file) as actual_file, open(expected_file) as expected_file:
actual_svg = actual_file.read()
expected_svg = expected_file.read()
assert actual_svg == expected_svg
Expand Down

0 comments on commit eabb2b5

Please sign in to comment.