unit test error - test00010

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
HarryvL
Veteran
Posts: 1285
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

unit test error - test00010

Post by HarryvL »

While preparing for a PR https://github.com/FreeCAD/FreeCAD/pull/7467 I ran into the following (unrelated?!) unit test error. Any idea what it is about and where to look for a fix?

Code: Select all

FAIL: test00010 (PathTests.TestRefactoredTestPost.TestRefactoredTestPost)
Test Outputting all arguments.

Traceback (most recent call last):
File "/home/harryvl/FreeCAD/build/Mod/Path/PathTests/TestRefactoredTestPost.py", line 194, in test00010
self.single_compare(
File "/home/harryvl/FreeCAD/build/Mod/Path/PathTests/TestRefactoredTestPost.py", line 99, in single_compare
self.assertEqual(gcode, expected)
AssertionError: 'Argu[259 chars]s the previous line\n --no-axis-modal O[2703 chars]0)\n' != 'Argu[259 chars]s the\n previous line\n[3103 chars]0)\n'
Diff is 6515 characters long. Set self.maxDiff to None to see it.

Code: Select all

OS: Ubuntu 20.04.5 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.30318 (Git)
Build type: Unknown
Branch: master
Hash: c0032e05c58da497fa152b3bae48b72804defa95
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.3.0
Locale: English/United States (en_US)
Installed mods: 
  * main.py
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: unit test error - test00010

Post by onekk »

HarryvL wrote: Fri Sep 09, 2022 1:41 pm ...
Probably related to "Path WB", but as far as I know the entire "Path WB" will be heavy modified in the next months, so maybe talking to @sliptonic or @mlampert will avoid maybe some inutile job.

Regards

Carlo D.
Last edited by onekk on Sat Sep 10, 2022 10:20 pm, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
HarryvL
Veteran
Posts: 1285
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: unit test error - test00010

Post by HarryvL »

If it is unrelated to FEM workbench (my target) then it shouldn’t hold my PR, but it does. Any idea how to take this hurdle?
vm4dim
Posts: 129
Joined: Tue Nov 23, 2021 1:05 am

Re: unit test error - test00010

Post by vm4dim »

HarryvL wrote: Fri Sep 09, 2022 1:41 pm

Code: Select all

Diff is 6515 characters long. Set self.maxDiff to None to see it.
Default maxDiff (in unittest/case.py) = 80*8 = 640
LarryWoestman
Posts: 98
Joined: Fri Oct 09, 2020 4:56 pm
Location: Oregon, USA

Re: unit test error - test00010

Post by LarryWoestman »

I just found out about this error in my code a couple of days ago.

The root cause is that the "argparse" python functions have a dependency on the number of columns in the terminal window that you start the tests from. If you run "./FreeCAD -c -t TestPathApp" it assumes 80 characters, but if you run "./FreeCADCmd -t TestPathApp" in the same code it may get a different number of columns. The test as currently written happens to be sensitive to the output of the argparse function that outputs the "help" information.

A workaround until I can get a fix installed is to start your tests from a terminal window that is 80 characters wide.
User avatar
HarryvL
Veteran
Posts: 1285
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: unit test error - test00010

Post by HarryvL »

LarryWoestman wrote: Fri Sep 09, 2022 4:28 pm IA workaround until I can get a fix installed is to start your tests from a terminal window that is 80 characters wide.
My terminal window is 80 characters wide
LarryWoestman
Posts: 98
Joined: Fri Oct 09, 2020 4:56 pm
Location: Oregon, USA

Re: unit test error - test00010

Post by LarryWoestman »

I'm sorry that didn't help. There must be something else going on that I can't reproduce so far.

You could comment out or delete that test in the Path/PathTests/TestRefactoredTestPost.py file, if you wish.

If you want to help figure out what the problem is, you could add a "self.maxDiff = None" line to the setUp routine at approximately line 75 in the Path/PathTests/TestRefactoredTestPost.py file (above the "self.doc = FreeCAD.ActiveDocument" line). That should allow the error message to show the full difference between what is expected and what it got. If you could capture the full error message and PM it to me (or attach it to a reply) then I can figure out what it is unhappy about.

You can run just that test with:

Code: Select all

./FreeCADCmd -t PathTests.TestRefactoredTestPost.TestRefactoredTestPost.test00010
LarryWoestman
Posts: 98
Joined: Fri Oct 09, 2020 4:56 pm
Location: Oregon, USA

Re: unit test error - test00010

Post by LarryWoestman »

The fixes for terminal window column count and showing the full "diff" for errors have been merged into master with commit f42a47aa, pull request #7469.
User avatar
HarryvL
Veteran
Posts: 1285
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: unit test error - test00010

Post by HarryvL »

LarryWoestman wrote: Tue Sep 13, 2022 9:08 pm The fixes for terminal window column count and showing the full "diff" for errors have been merged into master with commit f42a47aa, pull request #7469.
Thanks
Post Reply