Salome HOME
Fix failures of the exchange test cases on Windows
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Mon, 15 Jun 2020 13:37:13 +0000 (16:37 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Mon, 15 Jun 2020 13:37:13 +0000 (16:37 +0300)
src/ConnectorAPI/Test/__main__.py [new file with mode: 0644]
src/ExchangePlugin/Test/TestExport.py

diff --git a/src/ConnectorAPI/Test/__main__.py b/src/ConnectorAPI/Test/__main__.py
new file mode 100644 (file)
index 0000000..02a1983
--- /dev/null
@@ -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  #
+#                                                              #
+# ============================================================ #
index 72e1a15e1725a1e08165cee48b6ac64c09db0e5e..511b95835f9b936dca4d17d5c55b73a6ba5fa8a2 100644 (file)
@@ -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: