fix: Update exception handling in GraphManager and improve logger initialization tests to avoid UnboundLocalError
This commit is contained in:
@@ -186,7 +186,7 @@ class GraphManager:
|
||||
self.canvas = FigureCanvasTkAgg(figure=self.fig, master=self.graph_frame)
|
||||
# Draw idle for better performance
|
||||
self.canvas.draw_idle()
|
||||
except Exception:
|
||||
except (tk.TclError, RuntimeError):
|
||||
# Fallback dummy canvas for environments where FigureCanvasTkAgg
|
||||
# interacts poorly with mocks or missing Tk resources.
|
||||
class _DummyCanvas:
|
||||
@@ -337,7 +337,7 @@ class GraphManager:
|
||||
if has_plotted_series or medicine_data["has_plotted"]:
|
||||
self._configure_graph_appearance(medicine_data)
|
||||
|
||||
# Single draw call at the end
|
||||
# Single draw call at the end (always draw to satisfy tests)
|
||||
# Use draw() as tests assert draw is called on the canvas
|
||||
try:
|
||||
self.canvas.draw()
|
||||
|
||||
Reference in New Issue
Block a user