From 8e7579eade3b8c0f7230b1355bf77583ac688c34 Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Mon, 21 Sep 2020 15:51:31 +0300 Subject: [PATCH] CurvePlot test breaks --- tools/CurvePlot/src/python/test/CMakeLists.txt | 4 ++-- tools/CurvePlot/src/python/test/PlotTestBase.py | 6 +++--- .../test/{SalomePyQt_MockUp.py.in => SalomePyQt_MockUp.py} | 0 tools/CurvePlot/src/python/test/plot_test.py | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) rename tools/CurvePlot/src/python/test/{SalomePyQt_MockUp.py.in => SalomePyQt_MockUp.py} (100%) diff --git a/tools/CurvePlot/src/python/test/CMakeLists.txt b/tools/CurvePlot/src/python/test/CMakeLists.txt index f1ff87f79..e4193663b 100644 --- a/tools/CurvePlot/src/python/test/CMakeLists.txt +++ b/tools/CurvePlot/src/python/test/CMakeLists.txt @@ -40,8 +40,8 @@ INSTALL(DIRECTORY baselines DESTINATION ${SALOME_INSTALL_SCRIPT_PYTHON}/tests) SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_BINARY_DIR}/local) # point to local curveplot package in BUILD dir SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -#ADD_TEST(CurvePlotUnitTests ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/plot_test.py) -#SET_TESTS_PROPERTIES(CurvePlotUnitTests PROPERTIES ENVIRONMENT "${tests_env}") +ADD_TEST(CurvePlotUnitTests ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/plot_test.py) +SET_TESTS_PROPERTIES(CurvePlotUnitTests PROPERTIES ENVIRONMENT "${tests_env}") # For test purposes FILE(COPY ${_test_SCRIPTS} DESTINATION ${CRVPLOT_TEST_INSTALL}) diff --git a/tools/CurvePlot/src/python/test/PlotTestBase.py b/tools/CurvePlot/src/python/test/PlotTestBase.py index 922785f2e..7e9e5090b 100644 --- a/tools/CurvePlot/src/python/test/PlotTestBase.py +++ b/tools/CurvePlot/src/python/test/PlotTestBase.py @@ -81,11 +81,11 @@ class PlotTestBase(unittest.TestCase): def setUp(self): import sys - from curveplot.SalomePyQt_MockUp import SalomePyQt + from SalomePyQt_MockUp import SalomePyQt from curveplot.TableModel import TableModel from curveplot.CurveModel import CurveModel from curveplot.XYPlotSetModel import XYPlotSetModel - from curveplot.TestDesktop import TestDesktop + from TestDesktop import TestDesktop self.qpixmap = None self.keepDir = False @@ -95,7 +95,7 @@ class PlotTestBase(unittest.TestCase): self.tmpDir = None # Minimal UI setup: - self.app = QApplication(sys.argv) + #self.app = QApplication(sys.argv) desktop = TestDesktop(None) self.sgPyQt = SalomePyQt(desktop) desktop._sgPyQt = self.sgPyQt diff --git a/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in b/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py similarity index 100% rename from tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in rename to tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py diff --git a/tools/CurvePlot/src/python/test/plot_test.py b/tools/CurvePlot/src/python/test/plot_test.py index 326719332..82db5e775 100644 --- a/tools/CurvePlot/src/python/test/plot_test.py +++ b/tools/CurvePlot/src/python/test/plot_test.py @@ -20,7 +20,7 @@ # Author : A. Bruneton # from curveplot import * -from curveplot.PlotTestBase import PlotTestBase, processDecorator +from PlotTestBase import PlotTestBase, processDecorator from curveplot.PlotSettings import PlotSettings from pyqtside.QtWidgets import QApplication @@ -41,6 +41,7 @@ class PlotTest(PlotTestBase): def __init__(self, methodName): PlotTestBase.__init__(self, methodName) + ### ### Data generation @@ -49,6 +50,7 @@ class PlotTest(PlotTestBase): import numpy as np x = np.arange(100) y = np.sin(x*alpha/np.pi) + print(1) return x, y def generateExp(self, alpha=1.0): @@ -144,7 +146,7 @@ class PlotTest(PlotTestBase): x, y = self.generateSine() tw = self.showTabWidget() PlotController.AddCurve(x, y, curve_label="My curve", x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=False) - self.assertTrue(self.areScreenshotEqual(tw)) + self.assertTrue(self.areScreenshotEqual(tw), msg='Hello!') def testAddCurveAppend(self): x, y = self.generateSine() -- 2.39.2