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
This commit is contained in:
Stefan Brüns 2022-03-06 23:24:48 +00:00 committed by Git OBS Bridge
parent d3b3ca2cab
commit fa181a18f6
9 changed files with 180 additions and 16 deletions

View File

@ -0,0 +1,38 @@
From 68c7f70b7b6b01fdcac2f746e19cff7e71e24ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
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

View File

@ -0,0 +1,25 @@
From 73307991550f57da9504237581b03faf9bcc0824 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
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

View File

@ -0,0 +1,29 @@
From 70c5505a75ad545cb671eb73f29d5e1626aebf78 Mon Sep 17 00:00:00 2001
From: Bernd Hahnebach <bernd@bimstatik.org>
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

View File

@ -0,0 +1,47 @@
From a8b903511fead24ac61543ca129eb0737fa2327f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:568fa32a9601693ff9273f3a5a2e825915f58b2455ffa173bc23f981edecd07d
size 296986058

3
FreeCAD-0.19.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e40a1c343956e13c56cc8578d025ae83d68d9d20acda1732953bc8a3883e9722
size 296990652

View File

@ -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)

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Fri Mar 4 18:16:46 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- 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 <stefan.bruens@rwth-aachen.de>
- 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 <stefan.bruens@rwth-aachen.de>

View File

@ -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