From 629ac7caf26c5dd0da35f8361dba010a6f874821 Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 22 Apr 2019 14:08:40 +0300 Subject: [PATCH] Remove debug outputs --- test.hdfs/test.py | 20 ------------- test.hdfs/test_hdf.py | 68 +------------------------------------------ 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/test.hdfs/test.py b/test.hdfs/test.py index 969ac2ffc..69b88b668 100644 --- a/test.hdfs/test.py +++ b/test.hdfs/test.py @@ -17,17 +17,7 @@ if __name__ == '__main__': except: pass - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'w') - print("TEST start", file=dbgFile) - dbgFile.close() - # =========================================== proc = Popen([salomeKernelDir + "/bin/salome/runSalome.py", "--modules", "SHAPER,GEOM", "--gui", "--ns-port-log=" + portlogfile, sourceDir + "/test_hdf.py", "args:" + testfile + "," + portlogfile + "," + testlogfile + "," + salomeKernelDir + "," + sourceDir]) - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print("TEST Salome started", file=dbgFile) - dbgFile.close() - # =========================================== iter = 0 while not os.path.exists(portlogfile) and iter < 100: @@ -37,11 +27,6 @@ if __name__ == '__main__': while os.path.exists(portlogfile): sleep(0.1) - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print("TEST process log file", file=dbgFile) - dbgFile.close() - # =========================================== isOk = True with open(testlogfile, 'r') as inputFile: s = inputFile.read() @@ -53,9 +38,4 @@ if __name__ == '__main__': except: pass - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print("TEST finished {}".format(isOk), file=dbgFile) - dbgFile.close() - # =========================================== assert isOk, "Test failed" diff --git a/test.hdfs/test_hdf.py b/test.hdfs/test_hdf.py index 5aafa9a41..b1d399187 100644 --- a/test.hdfs/test_hdf.py +++ b/test.hdfs/test_hdf.py @@ -32,74 +32,29 @@ class TestHDF(unittest.TestCase): reffile = "" def setUp(self): - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest setUp() started", file=dbgFile) - dbgFile.close() - # =========================================== salome.salome_close() - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest previous session closed", file=dbgFile) - dbgFile.close() - # =========================================== # leave file name only (trim path and extension) fileName = os.path.basename(self.testfile) self.reffile = self.reffile + "/" + os.path.splitext(fileName)[0] + ".py" - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest reffile: {}".format(self.reffile), file=dbgFile) - dbgFile.close() - # =========================================== salome.salome_init(self.testfile, embedded=1) myStudyName = salome.myStudy._get_Name() self.session = salome.naming_service.Resolve('/Kernel/Session') self.session.emitMessage("connect_to_study") - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest Salome started", file=dbgFile) - dbgFile.close() - # =========================================== self.sg = SalomePyQt.SalomePyQt() self.sg.activateModule("Shaper") self.session = ModelAPI.ModelAPI_Session.get() self.partSet = self.session.moduleDocument() - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest Shaper started", file=dbgFile) - dbgFile.close() - # =========================================== def tearDown(self): - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest tearDown() started", file=dbgFile) - dbgFile.close() - # =========================================== salome.sg.UpdateView() self.sg.processEvents() salome.sg.FitAll() - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest tearDown() finished", file=dbgFile) - dbgFile.close() - # =========================================== def test_hdf_file(self): - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest start HDF file testing", file=dbgFile) - dbgFile.close() - # =========================================== self.assertTrue(self.partSet.size("Parts") > 0) - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest number of parts: {}".format(self.partSet.size("Parts")), file=dbgFile) - dbgFile.close() - # =========================================== aPartsList = [] for aPartIndex in range(self.partSet.size("Parts")): self.session.startOperation() @@ -107,19 +62,9 @@ class TestHDF(unittest.TestCase): aPart.activate() self.session.finishOperation() - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest test part: {}".format(aPartIndex), file=dbgFile) - dbgFile.close() - # =========================================== aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True)) # check reference data exec(open(self.reffile, "rb").read()) - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest test part finished", file=dbgFile) - dbgFile.close() - # =========================================== if __name__ == "__main__": @@ -134,25 +79,14 @@ if __name__ == "__main__": if len(sys.argv) > 5: TestHDF.reffile = sys.argv[5] - # =========================================== - dbgFile = open(os.getcwd() + "/dbgfile", 'a') - print(" UnitTest started with parameters:", file=dbgFile) - print(" testfile: {}".format(TestHDF.testfile), file=dbgFile) - print(" salomePortFile: {}".format(salomePortFile), file=dbgFile) - print(" salomeKernelDir: {}".format(salomeKernelDir), file=dbgFile) - print(" reffile: {}".format(TestHDF.reffile), file=dbgFile) - dbgFile.close() - # =========================================== aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF) unittest.TextTestRunner(stream=errFile).run(aTest) errFile.close() -# test_program = unittest.main(argv=[sys.argv[0]], exit=False) + # close Salome GUI proc = subprocess.Popen(salomeKernelDir + "/bin/salome/killSalome.py") try: os.remove(salomePortFile) except: print("Cannot remove file", file=f) - -# assert test_program.result.wasSuccessful(), "Test failed" -- 2.39.2