Skip to content

Commit 36c6d7a

Browse files
committed
Testing Chart error
1 parent 273abaa commit 36c6d7a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Diff for: jtop/gui/jtopgui.py

-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
# Get variables
2626
from ..core.common import get_var
2727
# Graphics elements
28-
from .lib.chart import Chart
2928
from .lib.colors import NColors
3029
from .lib.common import check_curses, set_xterm_title
3130
# Create logger
@@ -100,9 +99,6 @@ def __init__(self, stdscr, jetson, pages, init_page=0, start=True, loop=False, s
10099
if start:
101100
self.run(loop, seconds)
102101

103-
def __del__(self):
104-
Chart.reset_color_counter()
105-
106102
def run(self, loop, seconds):
107103
# In this program, we don't want keystrokes echoed to the console,
108104
# so we run this to disable that

Diff for: jtop/gui/lib/chart.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(self, jetson, name, callback, type_value=int, line="*", color_text=
9797

9898
@classmethod
9999
def reset_color_counter(cls):
100-
Chart.COLOR_COUNTER = 0
100+
cls.COLOR_COUNTER = 0
101101

102102
def __del__(self):
103103
# Remove from color counter

Diff for: jtop/tests/test_05_gui.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
from ..gui import JTOPGUI, ALL, GPU, CPU, MEM, ENGINE, CTRL, INFO
2525

2626

27+
@pytest.fixture(autouse=True)
28+
def reset_cube_test():
29+
Chart.reset_color_counter()
30+
yield
31+
Chart.reset_color_counter()
32+
33+
2734
def openGUI(stdscr, jetson):
2835
# Initialization Menu
2936
pages = [ALL]
@@ -44,15 +51,14 @@ def test_openGUI(setup_jtop_server):
4451
curses.start_color()
4552
# Reset counter charts
4653
Chart.reset_color_counter()
54+
assert Chart.COLOR_COUNTER == 0
4755
# Run jtop
4856
with jtop() as jetson:
4957
if jetson.ok():
5058
# Open JTOPGUI
5159
pages = openGUI(stdscr, jetson)
5260
# Start with selected page
5361
pages.set(0)
54-
# Reset counter charts
55-
Chart.reset_color_counter()
5662
assert True
5763

5864

0 commit comments

Comments
 (0)