Skip to content

Commit 0bb563d

Browse files
committed
Coverage tests: skipping benchmark iterations
1 parent a380e06 commit 0bb563d

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

qwt/tests/test_curvebenchmark1.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88

99
SHOW = True # Show test in GUI-based test launcher
1010

11+
import os
1112
import time
12-
import numpy as np
1313

14+
import numpy as np
15+
from qtpy.QtCore import Qt
1416
from qtpy.QtWidgets import (
1517
QApplication,
16-
QMainWindow,
1718
QGridLayout,
19+
QLineEdit,
20+
QMainWindow,
1821
QTabWidget,
19-
QWidget,
2022
QTextEdit,
21-
QLineEdit,
23+
QWidget,
2224
)
23-
from qtpy.QtCore import Qt
24-
from qwt.tests import utils
2525

26-
import os
26+
from qwt.tests import utils
2727

2828
if os.environ.get("USE_PYQWT5", False):
2929
USE_PYQWT5 = True
@@ -156,7 +156,7 @@ def __init__(self, max_n=1000000, parent=None, unattended=False, **kwargs):
156156
QApplication.processEvents()
157157

158158
t0g = time.time()
159-
self.run_benchmark(max_n, **kwargs)
159+
self.run_benchmark(max_n, unattended, **kwargs)
160160
dt = time.time() - t0g
161161
self.text.append("<br><br><u>Total elapsed time</u>: %d ms" % (dt * 1e3))
162162
self.tabs.setCurrentIndex(1 if unattended else 0)
@@ -173,8 +173,10 @@ def process_iteration(self, title, description, widget, t0):
173173
self.text.append("<br><i>%s:</i><br>%s" % (description, time_str))
174174
print("[%s] %s" % (utils.get_lib_versions(), time_str))
175175

176-
def run_benchmark(self, max_n, **kwargs):
177-
for idx in range(4, -1, -1):
176+
def run_benchmark(self, max_n, unattended, **kwargs):
177+
max_n = 1000 if unattended else max_n
178+
iterations = 0 if unattended else 4
179+
for idx in range(iterations, -1, -1):
178180
points = int(max_n / 10 ** idx)
179181
t0 = time.time()
180182
widget = BMWidget(2, points, **kwargs)

qwt/tests/test_curvebenchmark2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(self, max_n=1000, parent=None, unattended=False, **kwargs):
6969
max_n=max_n, parent=parent, unattended=unattended, **kwargs
7070
)
7171

72-
def run_benchmark(self, max_n, **kwargs):
72+
def run_benchmark(self, max_n, unattended, **kwargs):
7373
for points, symbols in zip(
7474
(max_n / 10, max_n / 10, max_n, max_n), (True, False) * 2
7575
):

qwt/tests/test_loadtest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88

99
SHOW = True # Show test in GUI-based test launcher
1010

11-
import time
1211
import os
12+
import time
1313

1414
# Local imports
1515
from qwt.tests import test_curvebenchmark1 as cb
1616
from qwt.tests import utils
1717

18-
1918
if os.environ.get("USE_PYQWT5", False):
2019
USE_PYQWT5 = True
2120
from PyQt4.Qwt5 import QwtPlot, QwtPlotCurve
@@ -42,9 +41,10 @@ def __init__(self, max_n=100, parent=None, unattended=False, **kwargs):
4241
max_n=max_n, parent=parent, unattended=unattended, **kwargs
4342
)
4443

45-
def run_benchmark(self, max_n, **kwargs):
44+
def run_benchmark(self, max_n, unattended, **kwargs):
4645
points, symbols = 100, False
47-
for _i_page in range(int(NPLOTS / (NCOLS * NROWS))):
46+
iterator = range(0, 1) if unattended else range(int(NPLOTS / (NCOLS * NROWS)))
47+
for _i_page in iterator:
4848
t0 = time.time()
4949
symtext = "with%s symbols" % ("" if symbols else "out")
5050
widget = LTWidget(NCOLS, points, symbols, **kwargs)

0 commit comments

Comments
 (0)