[solved] Test failures with 0.19.1

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Post Reply
User avatar
waebbl
Posts: 200
Joined: Thu Aug 16, 2018 3:12 pm

[solved] Test failures with 0.19.1

Post by waebbl »

As maintainer of FreeCAD on Gentoo, I'm currently researching for a crash bug reported from a Gentoo user and was running the test suite today (freecad --run-test 0) and got a few errors:

Code: Select all

======================================================================
ERROR: test_tetra10_yml (femtest.app.test_mesh.TestMeshEleTetra10)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Fem/femtest/app/test_mesh.py", line 508, in test_tetra10_yml
    femmesh_testfile = read(outfile)
  File "/usr/lib64/freecad/Mod/Fem/feminout/importYamlJsonMesh.py", line 166, in read
    raw_mesh_data = yaml.load(fp)
  File "/usr/lib/python3.8/site-packages/yaml/__init__.py", line 109, in load
    raise RuntimeError("Unsafe load() call disabled by Gentoo. See bug #659348")
RuntimeError: Unsafe load() call disabled by Gentoo. See bug #659348

======================================================================
ERROR: TestStartGui (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: TestStartGui
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/usr/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 146, in _import
    return original_import(name, *args, **kwargs)
  File "/usr/lib64/freecad/Mod/Start/TestStartGui.py", line 25, in <module>
    from TestStart.TestStartPage import TestStartPage
  File "/usr/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 146, in _import
    return original_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'TestStart'


----------------------------------------------------------------------
Ran 583 tests in 305.758s

FAILED (errors=2)
System exit
The first listed error is due to usage of a deprecated call to yaml.load, which has been disabled in Gentoo, but is discouraged and marked as deprecated by the pyyaml upstream project (see https://bugs.gentoo.org/659348 and https://msg.pyyaml.org/load). It could be solved by this patch:

Code: Select all

diff --git a/src/Mod/Fem/feminout/importYamlJsonMesh.py b/src/Mod/Fem/feminout/importYamlJsonMesh.py
index 9886248..43820c1 100644
--- a/src/Mod/Fem/feminout/importYamlJsonMesh.py
+++ b/src/Mod/Fem/feminout/importYamlJsonMesh.py
@@ -162,7 +162,7 @@ def read(
             or fileExtension.lower() == ".yml"
     ) and has_yaml:
         fp = pyopen(fileString, "rt")
-        raw_mesh_data = yaml.load(fp)
+        raw_mesh_data = yaml.load(fp, Loader=yaml.SafeLoader)
         fp.close()
     else:
         Console.PrintError(
-- 
2.31.1
The second listed error has already been fixed in (post 0.19.1 commit) git commit dfbfa67.

After solving these two issues, I get additional test errors:

Code: Select all

======================================================================
ERROR: test_all_css_placeholders_removed (TestStart.TestStartPage.TestStartPage)
Check to see if all of the CSS placeholders have been replaced.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Start/TestStart/TestStartPage.py", line 44, in test_all_css_placeholders_removed
    page = StartPage.handle()
  File "/usr/lib64/freecad/Mod/Start/StartPage/StartPage.py", line 334, in handle
    ALTCSS = encode(f.read())
  File "/usr/bin/../lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 434: ordinal not in range(128)

======================================================================
ERROR: test_all_html_placeholders_removed (TestStart.TestStartPage.TestStartPage)
Check to see if all of the HTML placeholders have been replaced.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Start/TestStart/TestStartPage.py", line 72, in test_all_html_placeholders_removed
    page = StartPage.handle()
  File "/usr/lib64/freecad/Mod/Start/StartPage/StartPage.py", line 334, in handle
    ALTCSS = encode(f.read())
  File "/usr/bin/../lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 434: ordinal not in range(128)

======================================================================
ERROR: test_all_js_placeholders_removed (TestStart.TestStartPage.TestStartPage)
Check to see if all of the JavaScript placeholders have been replaced.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Start/TestStart/TestStartPage.py", line 52, in test_all_js_placeholders_removed
    page = StartPage.handle()
  File "/usr/lib64/freecad/Mod/Start/StartPage/StartPage.py", line 334, in handle
    ALTCSS = encode(f.read())
  File "/usr/bin/../lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 434: ordinal not in range(128)

======================================================================
ERROR: test_files_do_not_contain_backslashes (TestStart.TestStartPage.TestStartPage)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Start/TestStart/TestStartPage.py", line 79, in test_files_do_not_contain_backslashes
    page = StartPage.handle()
  File "/usr/lib64/freecad/Mod/Start/StartPage/StartPage.py", line 334, in handle
    ALTCSS = encode(f.read())
  File "/usr/bin/../lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 434: ordinal not in range(128)

======================================================================
ERROR: test_html_validates (TestStart.TestStartPage.TestStartPage)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Start/TestStart/TestStartPage.py", line 97, in test_html_validates
    page = self.sanitize(StartPage.handle()) # Remove potentially sensitive data
  File "/usr/lib64/freecad/Mod/Start/StartPage/StartPage.py", line 334, in handle
    ALTCSS = encode(f.read())
  File "/usr/bin/../lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 434: ordinal not in range(128)

----------------------------------------------------------------------
Ran 587 tests in 304.174s

FAILED (errors=5)
System exit
To me they look like, if unicode values have been passed to decode, where ascii codes are expected. I couldn't yet track down, where they are coming from.

OS: Gentoo/Linux (XFCE//usr/share/xsessions/xfce)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.Unknown
Build type: Gentoo
Python version: 3.8.8
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Last edited by waebbl on Tue May 18, 2021 7:19 pm, edited 1 time in total.
User avatar
Kunda1
Veteran
Posts: 13447
Joined: Thu Jan 05, 2017 9:03 pm

Re: Test failures with 0.19.1

Post by Kunda1 »

bernd wrote: pinged by pinger macro
Also there is a PR for one of the issues described in OP https://github.com/FreeCAD/FreeCAD/pull/4767
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
waebbl
Posts: 200
Joined: Thu Aug 16, 2018 3:12 pm

Re: Test failures with 0.19.1

Post by waebbl »

Kunda1 wrote: Fri Apr 30, 2021 12:58 pm
bernd wrote: pinged by pinger macro
Also there is a PR for one of the issues described in OP https://github.com/FreeCAD/FreeCAD/pull/4767
Hmm, need to check my preferences. Didn't get a notification from the ping. The PR was from me, both issues have been fixed by PRs which I've been provided.
Post Reply