Skip to content

Commit

Permalink
Testing Chart error
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonghi committed Jul 25, 2024
1 parent 273abaa commit 36c6d7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 0 additions & 4 deletions jtop/gui/jtopgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# Get variables
from ..core.common import get_var
# Graphics elements
from .lib.chart import Chart
from .lib.colors import NColors
from .lib.common import check_curses, set_xterm_title
# Create logger
Expand Down Expand Up @@ -100,9 +99,6 @@ def __init__(self, stdscr, jetson, pages, init_page=0, start=True, loop=False, s
if start:
self.run(loop, seconds)

def __del__(self):
Chart.reset_color_counter()

def run(self, loop, seconds):
# In this program, we don't want keystrokes echoed to the console,
# so we run this to disable that
Expand Down
2 changes: 1 addition & 1 deletion jtop/gui/lib/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, jetson, name, callback, type_value=int, line="*", color_text=

@classmethod
def reset_color_counter(cls):
Chart.COLOR_COUNTER = 0
cls.COLOR_COUNTER = 0

def __del__(self):
# Remove from color counter
Expand Down
10 changes: 8 additions & 2 deletions jtop/tests/test_05_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
from ..gui import JTOPGUI, ALL, GPU, CPU, MEM, ENGINE, CTRL, INFO


@pytest.fixture(autouse=True)
def reset_cube_test():
Chart.reset_color_counter()
yield
Chart.reset_color_counter()


def openGUI(stdscr, jetson):
# Initialization Menu
pages = [ALL]
Expand All @@ -44,15 +51,14 @@ def test_openGUI(setup_jtop_server):
curses.start_color()
# Reset counter charts
Chart.reset_color_counter()
assert Chart.COLOR_COUNTER == 0
# Run jtop
with jtop() as jetson:
if jetson.ok():
# Open JTOPGUI
pages = openGUI(stdscr, jetson)
# Start with selected page
pages.set(0)
# Reset counter charts
Chart.reset_color_counter()
assert True


Expand Down

0 comments on commit 36c6d7a

Please sign in to comment.