[BioC] NAMESPACES, export, and unit tests

Seth Falcon sfalcon at fhcrc.org
Mon May 1 22:23:27 CEST 2006


Hi Paul,

Paul Shannon <pshannon at systemsbiology.net> writes:
>     1) In inst/unitTests/gaggleTest.R I call two functions from gaggle.R
>        which are otherwise hidden.
>
>             .gaggleNetworkToGraphNEL
>             .graphNELtoGaggleNetwork
>
>        It is very helpful to call these methods in gaggleTest, since  
> their
>        proper operation is crucial for the gaggle package.
>
>     2) Now that I am using NAMESPACES, it seems I can't call
>        these methods in gaggleTest.R unless they are explicitly  
> exported from
>        gaggle.R

One option is to use the ':::' function.  This allows one to override
namespace protection.  For example, in your test code you could call:

    gaggle:::.gaggleNetworkToGraphNEL()

':::' can be dangerous; non-exported functions can change without
notice.  If you are using it with your own package, well, that seems
safe enough :-)

+ seth



More information about the Bioconductor mailing list