<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 18, 2016 at 5:49 AM, Luca Delucchi <span dir="ltr"><<a href="mailto:lucadeluge@gmail.com" target="_blank">lucadeluge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id=":1bc" class="" style="overflow:hidden">I get the following error, but if I run the python<br>
code of the test I get not error. Do you have any idea how to solve<br>
it?<br>
<br>
        self.msgr.verbose(_("Delete space time %s  dataset <%s> from temporal "<br>
    TypeError: 'int' object is not callable</div></blockquote></div><br></div><div class="gmail_extra">This happens when the tested method uses translatable stings (usually for message or in case of error - which might be part of testing).<br><br></div><div class="gmail_extra">The reason is that underscore is used in interactive interpreter for the "last result" and this is inherited by doctest and at the same time, GRASS is using _ for translation and setting is as buildin. There is a ticked proposing imports instead of buildin [1]. I already implemented this for wxGUI few years back (for GUI you now have to explicitly import _ function [2]). To my understanding, this should avoid the clash of two different underscores (when implemented everywhere).<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">The workaround for now is to do some additional definitions of underscore. There is a function in gunittest which will do it for you [3]. You need to explicitly call it before you execute the doctest which is exactly what the dedicated test files in testsuites are doing, e.g. the one for script package [4].<br></div><div class="gmail_extra"><br>[1] <a href="https://trac.osgeo.org/grass/ticket/2425">https://trac.osgeo.org/grass/ticket/2425</a><br>[2] <a href="https://trac.osgeo.org/grass/changeset/67687">https://trac.osgeo.org/grass/changeset/67687</a><br>[3] <a href="https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/utils.py#L35">https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/utils.py#L35</a><br>[4] <a href="https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/testsuite/test_doctests.py">https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/testsuite/test_doctests.py</a><br></div></div>