<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 31, 2014 at 11:53 AM, Pietro <span dir="ltr"><<a href="mailto:peter.zamb@gmail.com" target="_blank">peter.zamb@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Fri, Jan 31, 2014 at 3:53 PM, Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com">wenzeslaus@gmail.com</a>> wrote:<br>


>> I've used doctest to cover some of the pygrass' functions and modules,<br>
>> but I don't like too much, at the moment to test the pygrass' doctest<br>
>> you have to be inside the NorthCarolina/user1 location/mapset, that is<br>
>> not always practical.<br>
><br>
><br>
> On the other hand, my impression from writing tests was that sometimes it<br>
> would be advantageous<br>
> to have some prepared location with everything, so I would like to go in the<br>
> way of supporting different locations rather then requiring all tests to use<br>
> only data their generate in the preparation phase.<br>
<br>
</div>I agree, perhaps we can use the demolocation in the trunk for this purpose?<br>
May be when we run the tests, the testing framework could set<br>
everything to run on the demolocation, run the test and then restore<br>
the previous configuration?<br>
<div class="im"><br></div></blockquote><div>For sure. This is how the compilation works or at least is supposed to work. But also, I would like test itself to specify in which location(s) it can run and then run it in these locations.</div>

<div><br></div><div>If you would like to use this now, my very limited knowledge of Makefiles tells me that you can try to use `run_grass` in Makefile. I've never tried but according to gui/wxpython/Makefile it should work. Try it outside grass session. You Makefile should contain something like this</div>

<div><br></div><div><div>default: $(DSTFILES)</div><div><span style="white-space:pre">        ...</span><br></div><div><span class="" style="white-space:pre">      </span>-$(MAKE) mytest<br></div><div><div>mytest: </div><div><span class="" style="white-space:pre">       </span>$(call run_grass,$(PYTHON) myscript.py params)</div>

</div></div><div><br></div><div>`make` or `make test` should then run `python myscript.py params` in demolocation. But as I said it is probably just a theory...</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="im">
<br>
>> Would be nice to have something that run independently from the<br>
>> location/mapset. 'm studying the unittest framework and in a short<br>
>> time I would like to start to write some unittest for the pygrass<br>
>> library.<br>
><br>
><br>
> unittest test which does not rely on location/mapset is probably the default<br>
> and preferred way, so I'm looking forward to see this.<br>
<br>
</div>I mean, would be nice to insert this on the GRASS testing framework,<br>
but I will not work on this.<br>
<div class="im"><br></div></blockquote><div>Do what ever you think is advantageous to you, I will then consider how to integrate it. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="im">
<br>
>> I really like it, and they can also help users to move they bash<br>
>> scripts to python.<br>
><br>
> I used doctest in this way for the first time but it seems that it is as<br>
> easy as writing bash script and you get doctest functionality and Python<br>
> functionality to examine your results. The testing framework (perhaps<br>
> unittest class inside some script) would run the doctest file in the right<br>
> environment (location) or in several environments if desired.<br>
<br>
</div>yes, may be not only for the doctest but for everything?<br>
</blockquote></div><br></div><div class="gmail_extra">If I inferred correctly what you mean the answer is yes. I will explain this idea further in next days or weeks.</div></div>