[GRASS-dev] gunittest and unicode

Stefan Blumentrath Stefan.Blumentrath at nina.no
Fri Mar 15 04:13:08 PDT 2019


Dear all,

Recently, I have been looking into failing tests.
A number of tests fail with "AssertionError: actual argument is not a string" [1]. These tests use "assertLooksLike".

The reason why the tests are failing is that stdout from "SimpleModule" deliveres unicode objects [2], while  "assertLooksLike" only allows/expects str objects [3].

In many cases, encoding stdout wth utf-8 (or wrapping it into str() like in [2]) would fix this.

If you consider this an appropriate solution I can fix tests accordingly...

Alternatively, assertLooksLike could be changed to accept Unicode (too)...

Let me know. I do like to contribute to getting a "green build" (as Panos put it), but I want to double check what the most appropriate solution is before I make any changes...
And in particular I do not want to mess with stuff others are currently working on...

BTW, it the nc_spm_full_v2alpha test data available somewhere?

Cheers
Stefan

1: http://fatra.cnr.ncsu.edu/grassgistests/reports_for_date-2019-03-14-07-00/report_for_nc_spm_full_v2alpha_nc/vector/v.what/test_vwhat_ncspm/index.html
2: https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/gmodules.py#L39
3: https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/case.py#L179


P.S.: The v.vect.stats test does not really test what it is supposed to test, which is why it does not fail although it also uses assertLooksLike: https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.vect.stats/testsuite/test_vect_stats.py#L63

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20190315/0fa06b52/attachment.html>


More information about the grass-dev mailing list