From c5060d16e801a4cdb82257f091c71451459616e0 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Mon, 15 Jun 2020 16:37:13 +0300 Subject: [PATCH] Fix failures of the exchange test cases on Windows --- src/ConnectorAPI/Test/__main__.py | 24 ++++++++++++++++++++++++ src/ExchangePlugin/Test/TestExport.py | 11 +++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/ConnectorAPI/Test/__main__.py diff --git a/src/ConnectorAPI/Test/__main__.py b/src/ConnectorAPI/Test/__main__.py new file mode 100644 index 000000000..02a198310 --- /dev/null +++ b/src/ConnectorAPI/Test/__main__.py @@ -0,0 +1,24 @@ +# Copyright (C) 2016-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ============================================================ # +# # +# Attention: Keep this file for correct execution on Windows # +# # +# ============================================================ # diff --git a/src/ExchangePlugin/Test/TestExport.py b/src/ExchangePlugin/Test/TestExport.py index 72e1a15e1..511b95835 100644 --- a/src/ExchangePlugin/Test/TestExport.py +++ b/src/ExchangePlugin/Test/TestExport.py @@ -157,8 +157,15 @@ def testExportXAO(theFile, theEmptyFormat = False): # Check exported file aRefPath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Xao", "box2.xao") - import filecmp - assert filecmp.cmp(theFile, aRefPath) + # endlines may be different on different platforms, thus compare files line-by-line + areFilesEqual = True + with open(theFile, 'r') as file, open(aRefPath, 'r') as ref: + l1 = l2 = True + while l1 and l2 and areFilesEqual: + l1 = file.readline() + l2 = ref.readline() + areFilesEqual = l1 == l2 + assert areFilesEqual if __name__ == '__main__': with TemporaryDirectory() as tmp_dir: -- 2.39.2