<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 15, 2019 at 7:13 AM Stefan Blumentrath <<a href="mailto:Stefan.Blumentrath@nina.no">Stefan.Blumentrath@nina.no</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="NO-BOK">
<div class="gmail-m_-7356732136783999381WordSection1">
<p class="MsoNormal">Dear all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-GB">Recently, I have been looking into failing tests.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">A number of tests fail with “AssertionError: actual argument is not a string” [1]. These tests use “assertLooksLike”.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">The reason why the tests are failing is that stdout from “SimpleModule” deliveres unicode objects [2], while  “assertLooksLike” only allows/expects str objects [3].<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">In many cases, encoding stdout wth utf-8 (or wrapping it into str() like in [2]) would fix this.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">If you consider this an appropriate solution I can fix tests accordingly…<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Alternatively, assertLooksLike could be changed to accept Unicode (too)…</span></p></div></div></blockquote><div><br></div><div>Generally, the rule is to expect unicode and deal with that, so in this case check for str or unicode (use e.g. <a href="https://stackoverflow.com/a/11301392/1058453">https://stackoverflow.com/a/11301392/1058453</a>)</div><div><br></div><div>Anna</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="NO-BOK"><div class="gmail-m_-7356732136783999381WordSection1"><p class="MsoNormal"><span lang="EN-GB"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">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…<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">And in particular I do not want to mess with stuff others are currently working on…<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">BTW, it the nc_spm_full_v2alpha test data available somewhere?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Stefan <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">1: <a href="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" target="_blank">
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</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">2: <a href="https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/gmodules.py#L39" target="_blank">
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/gmodules.py#L39</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">3: <a href="https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/case.py#L179" target="_blank">
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/case.py#L179</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">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:
<a href="https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.vect.stats/testsuite/test_vect_stats.py#L63" target="_blank">
https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.vect.stats/testsuite/test_vect_stats.py#L63</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
</div>
</div>

_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-dev</a></blockquote></div></div></div>