From fa181a18f6aeebc1ec3911c5c9b3b07543005b164fbfe28ad87d5f6c2239f56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 6 Mar 2022 23:24:48 +0000 Subject: [PATCH] Accepting request 959594 from home:StefanBruens:branches:science - Add some unit test fixes: * 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch * 0001-Test-fix-exception-handling-in-tests-for-units.patch * 0001-Test-Provide-more-useful-information-when-unit-trans.patch * 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch - Update to version 0.19.4: * Lots of bugfixes, for details see https://github.com/FreeCAD/FreeCAD/releases/tag/0.19.4 OBS-URL: https://build.opensuse.org/request/show/959594 OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=145 --- ...e-useful-information-when-unit-trans.patch | 38 +++++++++++++++ ...xception-handling-in-tests-for-units.patch | 25 ++++++++++ ...t-needed-u-before-py3-unicode-string.patch | 29 ++++++++++++ ...character-encoding-for-micro-siemens.patch | 47 +++++++++++++++++++ FreeCAD-0.19.3.tar.gz | 3 -- FreeCAD-0.19.4.tar.gz | 3 ++ FreeCAD-test.spec | 8 ++-- FreeCAD.changes | 16 +++++++ FreeCAD.spec | 27 +++++++---- 9 files changed, 180 insertions(+), 16 deletions(-) create mode 100644 0001-Test-Provide-more-useful-information-when-unit-trans.patch create mode 100644 0001-Test-fix-exception-handling-in-tests-for-units.patch create mode 100644 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch create mode 100644 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch delete mode 100644 FreeCAD-0.19.3.tar.gz create mode 100644 FreeCAD-0.19.4.tar.gz diff --git a/0001-Test-Provide-more-useful-information-when-unit-trans.patch b/0001-Test-Provide-more-useful-information-when-unit-trans.patch new file mode 100644 index 0000000..46fb2a8 --- /dev/null +++ b/0001-Test-Provide-more-useful-information-when-unit-trans.patch @@ -0,0 +1,38 @@ +From 68c7f70b7b6b01fdcac2f746e19cff7e71e24ed8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Fri, 4 Mar 2022 19:14:15 +0100 +Subject: [PATCH 1/2] Test: Provide more useful information when unit + translation fails + +Add the input quantity and the target scheme to the exception output. +Also make the output formatting more canonical and remove the unused +"s" temporary. +--- + src/Mod/Test/UnitTests.py | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py +index a77239977f..4726e46037 100644 +--- a/src/Mod/Test/UnitTests.py ++++ b/src/Mod/Test/UnitTests.py +@@ -121,14 +121,13 @@ class UnitBasicCases(unittest.TestCase): + q1 = FreeCAD.Units.Quantity(q1) + q1.Format = {'Precision': 16} + for idx, val in enumerate(schemes): +- t = FreeCAD.Units.schemaTranslate(q1, idx) ++ [t, amountPerUnit, unit] = FreeCAD.Units.schemaTranslate(q1, idx) + try: +- q2 = FreeCAD.Units.Quantity(t[0]) ++ q2 = FreeCAD.Units.Quantity(t) + if math.fabs(q1.Value - q2.Value) > 0.01: + print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip()) + except Exception as e: +- s = "{}: {}".format(e, t[0]) +- print (" ".join(str(e)).encode("utf-8").strip()) ++ print ("{} : {} : {} : {}".format(q1, i, val, e).encode("utf-8").strip()) + + def testVoltage(self): + q1 = FreeCAD.Units.Quantity("1e20 V") +-- +2.35.1 + diff --git a/0001-Test-fix-exception-handling-in-tests-for-units.patch b/0001-Test-fix-exception-handling-in-tests-for-units.patch new file mode 100644 index 0000000..58b31ff --- /dev/null +++ b/0001-Test-fix-exception-handling-in-tests-for-units.patch @@ -0,0 +1,25 @@ +From 73307991550f57da9504237581b03faf9bcc0824 Mon Sep 17 00:00:00 2001 +From: wmayer +Date: Tue, 25 Jan 2022 20:20:46 +0100 +Subject: [PATCH] Test: fix exception handling in tests for units + +--- + src/Mod/Test/UnitTests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py +index e9006455a0..9228684250 100644 +--- a/src/Mod/Test/UnitTests.py ++++ b/src/Mod/Test/UnitTests.py +@@ -128,7 +128,7 @@ class UnitBasicCases(unittest.TestCase): + print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip()) + except Exception as e: + s = "{}: {}".format(e, t[0]) +- print (" ".join(e).encode("utf-8").strip()) ++ print (" ".join(str(e)).encode("utf-8").strip()) + + def testVoltage(self): + q1 = FreeCAD.Units.Quantity("1e20 V") +-- +2.35.1 + diff --git a/0001-Test-remove-not-needed-u-before-py3-unicode-string.patch b/0001-Test-remove-not-needed-u-before-py3-unicode-string.patch new file mode 100644 index 0000000..122bc7f --- /dev/null +++ b/0001-Test-remove-not-needed-u-before-py3-unicode-string.patch @@ -0,0 +1,29 @@ +From 70c5505a75ad545cb671eb73f29d5e1626aebf78 Mon Sep 17 00:00:00 2001 +From: Bernd Hahnebach +Date: Wed, 22 Sep 2021 08:06:47 +0200 +Subject: [PATCH] Test: remove not needed u before py3 unicode string + +--- + src/Mod/Test/UnitTests.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py +index 6584ae6fc5..5c6ffea7e6 100644 +--- a/src/Mod/Test/UnitTests.py ++++ b/src/Mod/Test/UnitTests.py +@@ -125,10 +125,10 @@ class UnitBasicCases(unittest.TestCase): + try: + q2 = FreeCAD.Units.Quantity(t[0]) + if math.fabs(q1.Value - q2.Value) > 0.01: +- print (u" {} : {} : {} : {} : {}".format(q1,q2, t, i, val).encode("utf-8").strip()) ++ print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip()) + except Exception as e: + s = "{}: {}".format(e, t[0]) +- print (u" ".join(e).encode("utf-8").strip()) ++ print (" ".join(e).encode("utf-8").strip()) + + def testVoltage(self): + q1 = FreeCAD.Units.Quantity("1e20 V") +-- +2.35.1 + diff --git a/0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch b/0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch new file mode 100644 index 0000000..dcc650b --- /dev/null +++ b/0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch @@ -0,0 +1,47 @@ +From a8b903511fead24ac61543ca129eb0737fa2327f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sat, 5 Mar 2022 00:26:11 +0100 +Subject: [PATCH 2/2] Base: Fix wrong character encoding for micro-siemens + +Contrary to any other Unit with micro prefix (e.g. ug, uH, uF) the +string was created with a Latin1 encoding instead of UTF-8. + +The problem can be verified with these python statements: +``` +FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroSiemens, 0) +FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroGram, 0) +``` +--- + src/Base/UnitsSchemaInternal.cpp | 2 +- + src/Base/UnitsSchemaMKS.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp +index 69b65fa9fc..78ea82a6eb 100644 +--- a/src/Base/UnitsSchemaInternal.cpp ++++ b/src/Base/UnitsSchemaInternal.cpp +@@ -351,7 +351,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact + } + else if (unit == Unit::ElectricalConductance) { + if (UnitValue < 1e-9) { +- unitString = QString::fromLatin1("\xC2\xB5S"); ++ unitString = QString::fromUtf8("\xC2\xB5S"); + factor = 1e-12; + } + else if (UnitValue < 1e-6) { +diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp +index 11d23d7d0b..795b7afc54 100644 +--- a/src/Base/UnitsSchemaMKS.cpp ++++ b/src/Base/UnitsSchemaMKS.cpp +@@ -299,7 +299,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q + } + else if (unit == Unit::ElectricalConductance) { + if (UnitValue < 1e-9) { +- unitString = QString::fromLatin1("\xC2\xB5S"); ++ unitString = QString::fromUtf8("\xC2\xB5S"); + factor = 1e-12; + } + else if (UnitValue < 1e-6) { +-- +2.35.1 + diff --git a/FreeCAD-0.19.3.tar.gz b/FreeCAD-0.19.3.tar.gz deleted file mode 100644 index 87d2873..0000000 --- a/FreeCAD-0.19.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:568fa32a9601693ff9273f3a5a2e825915f58b2455ffa173bc23f981edecd07d -size 296986058 diff --git a/FreeCAD-0.19.4.tar.gz b/FreeCAD-0.19.4.tar.gz new file mode 100644 index 0000000..1046553 --- /dev/null +++ b/FreeCAD-0.19.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e40a1c343956e13c56cc8578d025ae83d68d9d20acda1732953bc8a3883e9722 +size 296990652 diff --git a/FreeCAD-test.spec b/FreeCAD-test.spec index 80c4f05..b0f6d72 100644 --- a/FreeCAD-test.spec +++ b/FreeCAD-test.spec @@ -17,7 +17,7 @@ Name: FreeCAD-test -Version: 0.19.3 +Version: 0.19.4 Release: 0 Summary: Meta source package that runs the FreeCAD testsuite when built License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -40,7 +40,7 @@ export PYTHONPATH=%{_libdir}/FreeCAD/lib python3 -c "\ import FreeCAD import unittest -print(FreeCAD.__unit_test__) +print(FreeCAD.__unit_test__, file=sys.stderr) results = {} for name in FreeCAD.__unit_test__: suite = unittest.TestSuite() @@ -53,8 +53,8 @@ for name in FreeCAD.__unit_test__: totalerrors = 0 totalfailures = 0 for [name,res] in results.items(): - print(name) - print(res) + print(name, file=sys.stderr) + print(res, file=sys.stderr) totalerrors += len(res.errors) totalfailures += len(res.failures) diff --git a/FreeCAD.changes b/FreeCAD.changes index ce30281..ae6dd79 100644 --- a/FreeCAD.changes +++ b/FreeCAD.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Fri Mar 4 18:16:46 UTC 2022 - Stefan Brüns + +- Add some unit test fixes: + * 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch + * 0001-Test-fix-exception-handling-in-tests-for-units.patch + * 0001-Test-Provide-more-useful-information-when-unit-trans.patch + * 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch + +------------------------------------------------------------------- +Thu Mar 3 17:42:20 UTC 2022 - Stefan Brüns + +- Update to version 0.19.4: + * Lots of bugfixes, for details see + https://github.com/FreeCAD/FreeCAD/releases/tag/0.19.4 + ------------------------------------------------------------------- Sun Feb 6 17:31:23 UTC 2022 - Stefan Brüns diff --git a/FreeCAD.spec b/FreeCAD.spec index f919cf7..4be3e95 100644 --- a/FreeCAD.spec +++ b/FreeCAD.spec @@ -27,7 +27,7 @@ %bcond_without smesh Name: FreeCAD -Version: 0.19.3 +Version: 0.19.4 Release: 0 Summary: General Purpose 3D CAD Modeler License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -38,6 +38,13 @@ Source0: https://github.com/FreeCAD/FreeCAD/archive/refs/tags/%{version}. Patch1: fix_unittestgui_tkinter_py3.patch # PATCH-FIX-UPSTREAM Rebased https://github.com/wwmayer/FreeCAD/commit/bb9bcbd51df7 Patch2: fix-smesh-vtk9.patch +# PATCH-FIX-UPSTREAM +Patch3: 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch +# PATCH-FIX-UPSTREAM +Patch4: 0001-Test-fix-exception-handling-in-tests-for-units.patch +# PATCH-FIX-UPSTREAM +Patch5: 0001-Test-Provide-more-useful-information-when-unit-trans.patch +Patch6: 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch # Test suite fails on 32bit and I don't want to debug that anymore ExcludeArch: %ix86 %arm ppc s390 s390x @@ -144,14 +151,6 @@ sed -i '1c#!%{__python3}' \ src/Mod/TechDraw/TDTest/D*Test.py \ src/Mod/Test/testmakeWireString.py -# Fix "non-executable-script" rpmlint warning -chmod 755 src/Mod/AddonManager/AddonManager.py \ - src/Mod/Robot/KukaExporter.py \ - src/Mod/Robot/MovieTool.py \ - src/Mod/Spreadsheet/importXLSX.py \ - src/Mod/TechDraw/TDTest/D*Test.py \ - src/Mod/Test/testmakeWireString.py - # Fix "wrong-script-end-of-line-encoding" rpmlint warning sed -i 's/\r$//' src/Mod/Mesh/App/MeshTestsApp.py sed -i 's/\r$//' src/Mod/Part/MakeBottle.py @@ -178,6 +177,7 @@ rm src/3rdparty/Pivy-0.5 -fr -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \ -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/%{name} \ -DCMAKE_SKIP_RPATH:BOOL=OFF \ + -DCMAKE_SKIP_INSTALL_RPATH:BOOL=OFF \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ -DOCC_INCLUDE_DIR=%{_includedir}/opencascade \ -DRESOURCEDIR=%{_datadir}/%{name} \ @@ -225,6 +225,15 @@ yacc.yacc(module=importCSG,outputdir=\"./\") " rm parser.out +# Fix "non-executable-script" rpmlint warning +# Run after install, as CMake "install(FILES...) sets rw- permissions +chmod 755 %{buildroot}%{_libdir}/FreeCAD/Mod/AddonManager/AddonManager.py \ + %{buildroot}%{_libdir}/FreeCAD/Mod/Robot/KukaExporter.py \ + %{buildroot}%{_libdir}/FreeCAD/Mod/Robot/MovieTool.py \ + %{buildroot}%{_libdir}/FreeCAD/Mod/Spreadsheet/importXLSX.py \ + %{buildroot}%{_libdir}/FreeCAD/Mod/TechDraw/TDTest/D*Test.py \ + %{buildroot}%{_libdir}/FreeCAD/Mod/Test/testmakeWireString.py + %suse_update_desktop_file -r org.freecadweb.FreeCAD Education Engineering # Remove unneeded files