Skip to content

Fix unit tests on windows, add Windows pipeline to CI

Jonathan Neuhauser requested to merge joneuhauser/extensions:unittests into master

Some fixes to make the unit tests run on Windows. The output of the extensions was fine - I didn't have to change anything - but some fixes in the tester library were necessary.

  • Where output of the extension is read from stdout, normalize line endings
  • Use subprocess.Popen instead of an ancient hack to avoid encoding problems in WebSlicer
  • Some paths were hardcoded
  • Skip some tests that don't work on Windows without additional effort.
  • The mock calls encoded the command line args in a hash, but sorted them before stripping paths (sort order was different on Windows and Linux). Now only keyword args are sorted, avoiding this problem
  • The mock call hash also included the input files as attachment, which had different line terminators
  • In some mock call input files, relative paths were used. This is (crudely) patched by replacing ".\" by "./".
  • In CI, some rounding differences in test_polyhedron_3d were observed. This was fixed by adding a CompareNumericFuzzy filter, but this filter didn't take scientific notation into account (fixed). Also -0 and 0 were not seen as equal, which lead to weird XML diff output since [-0] == [0], so no diff was actually shown. This has been fixed by comparing the parsed path data instead of the raw strings.

Also added a CI run on the Gitlab shared runners for Python 3.8. I think one Python version is enough in this case, because the runner is relatively slow (-> uses more CI minutes). The coverage from Windows and all Linux python versions is combined, yielding a total coverage (so coverage went up a bit in this MR because it covers WIndows-only code for the first time)

Edited by Jonathan Neuhauser

Merge request reports