[rkward-devel] rkwardtests & docs

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Nov 2 09:16:29 UTC 2010


Hi,

On Monday 01 November 2010, meik michalke wrote:
> ok, i've tried something different. all tests are now run in the temp suite
> dir by default, so any output goes there as well. as for the problem of
> loading files, the class "RKTest" gained a new slot called "files" for
> those. just define them relative to the test standard folder. they will be
> copied to the temp dir and can then be used by their simple file name.

sounds like a clean solution.
 
> however, i found something new ;-) until now each test run left an object
> called "suite" in .GlobalEnv, which was created by a source() call in
> "rktest.makeplugintests.R", line 47. it took a while until i managed to
> make all functions run without that global object in place, that is, the
> mentioned source() call is now called with the parameter "local=TRUE", so
> the "suite" object is created only in the test function environment. this
> works great, with one exception: it seems to break the "active_binding"
> test in "rkward_application_tests":
> 
> <error>
> Error in bindingIsActive(\"active.binding\", rkward::.rk.watched.symbols) :
>    no binding for \"active.binding\"
> </error>
> 
> this still happens even after i sourced the R file manually, so "suite" is
> actually present in .GlobalEnv, and then run
> 
> rktest.makeplugintests("rkward_application_tests.R",
> test.id="active_binding")
> 
> but the error doesn't occur if "local=TRUE" is removed again (it's FALSE by
> default).

This last bit is easily explained: The local object "suite" is found before 
the global one, and so the local "suite" gets run.

> frankly, i don't get it. any idea how that affects this very
> test? has it something to do with the reference to
> rkward::.rk.watched.symbols?

The key thing is the call to makeActiveBinding(). Currently, we need to 
override that in order to be able to detect changes in objects which are 
active bindings. Having a symbol by that name in rkward::.rk.watched.symbols 
bascially just means that our version of makeActiveBinding() was called.

So far, all we did was to mask makeActiveBinding(). That was enough for the 
old version of the test, since the test-function ultimately had .GlobalEnv as 
its enclosing environment. In the new version it has package:rkwardtests as 
the enclosing environment, and that changes symbol in subtle and confusing 
ways. And so, actually, yes, this showed a real bug, although one that most 
users would not be likely to trigger.

The SVN version now makes a better effort at actually replacing 
base::makeActiveBinding(), and the test passes again.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20101102/a4749203/attachment.sig>


More information about the Rkward-devel mailing list