Skip to content

Commit bc3c4e3

Browse files
committed
style: fix pylint warnings to pass CI checks
1 parent 817675c commit bc3c4e3

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/UniparkGUI.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626

2727
class UniParkApp(tk.Tk):
28+
# pylint: disable=too-many-instance-attributes
2829
def __init__(self):
2930
super().__init__()
3031

@@ -89,7 +90,6 @@ def get_time_phase(self):
8990
return "DEFLUSSO POMERIDIANO", 25 # Le auto iniziano a uscire
9091
elif 19 <= hour < 22:
9192
return "SVUOTAMENTO SERALE", 10 # Parcheggi quasi deserti
92-
else:
9393
return "FASCIA NOTTURNA", 2 # Nessuna attività
9494

9595
def set_theme_colors(self):
@@ -225,6 +225,7 @@ def setup_main_layout(self):
225225
0, 0, anchor="nw", image=self.bg_img, tags="static_map"
226226
)
227227
except Exception as e:
228+
# pylint: disable=broad-exception-caught
228229
self.canvas.create_text(
229230
400,
230231
300,
@@ -620,7 +621,7 @@ def on_close(self):
620621
self.running = False
621622
self.destroy()
622623
# os._exit(0) uccide immediatamente tutti i thread orfani in background
623-
os._exit(0)
624+
os._exit(0) # pylint: disable=protected-access
624625

625626

626627
if __name__ == "__main__":

tests/test_UniParkGUI.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pylint: disable=redefined-outer-name
22
from unittest.mock import MagicMock, patch
3+
34
import pytest
45

56
# Importiamo la classe GUI
@@ -21,11 +22,11 @@ def mock_app():
2122
# Qui abbiamo aggiunto maxsize, minsize, Canvas e PhotoImage!
2223
with patch("tkinter.Tk.geometry"), patch("tkinter.Tk.title"), patch(
2324
"tkinter.Tk.configure"
24-
), patch("tkinter.Tk.resizable"), patch(
25-
"tkinter.Tk.maxsize"
25+
), patch("tkinter.Tk.resizable"), patch("tkinter.Tk.maxsize"), patch(
26+
"tkinter.Tk.minsize"
27+
), patch(
28+
"tkinter.Tk.protocol"
2629
), patch(
27-
"tkinter.Tk.minsize"
28-
), patch("tkinter.Tk.protocol"), patch(
2930
"tkinter.Tk.destroy"
3031
), patch(
3132
"tkinter.Tk.mainloop"
@@ -89,7 +90,7 @@ def mock_app():
8990
app.running = False
9091
app.system = mock_system
9192
app.zones = mock_system.zones
92-
app.canvas = MagicMock() # Mock the canvas to avoid draw errors
93+
app.canvas = MagicMock() # Mock the canvas to avoid draw errors
9394

9495
# Manually populate fake widgets
9596
app.zone_widgets = {
@@ -99,7 +100,7 @@ def mock_app():
99100
"lbl_details": MagicMock(),
100101
"lbl_queue": MagicMock(),
101102
"btn_park": MagicMock(),
102-
"btn_unpark": MagicMock()
103+
"btn_unpark": MagicMock(),
103104
}
104105
}
105106

@@ -118,7 +119,7 @@ def test_gui_initialization(mock_app):
118119
def test_gui_user_park(mock_app):
119120
"""Test clicking the PARK button."""
120121
app, mock_zone = mock_app
121-
122+
122123
# NOTA: Ora si chiama user_action (non più manual_action)
123124
app.user_action(mock_zone, "park")
124125

@@ -130,7 +131,7 @@ def test_gui_user_park(mock_app):
130131
def test_gui_user_unpark(mock_app):
131132
"""Test clicking the UNPARK button."""
132133
app, mock_zone = mock_app
133-
134+
134135
# NOTA: Ora si chiama user_action
135136
app.user_action(mock_zone, "unpark")
136137

@@ -157,4 +158,4 @@ def test_gui_update_widgets(mock_app):
157158
app.update_widgets_once()
158159

159160
# Verifica che la UI sia stata chiamata per aggiornarsi
160-
app.zone_widgets["TestZone"]["progress"].config.assert_called()
161+
app.zone_widgets["TestZone"]["progress"].config.assert_called()

0 commit comments

Comments
 (0)