Missing Guile Bindings and False Positive Unit tests

Chad Albers calbers at neomantic.com
Sun Feb 19 16:46:54 EST 2017


Hi,

I found some problems with some unit tests for the Guile bindings.
Here's the background.

Rather than use the Python bindings, I wanted to use guile to add/manipulate
my GnuCash data.  From the Python bindings, I deduced that the entry
point into creating
transactions is via a construct called a "session".  Accordingly, I went to find
the Guile equivalent: "qof-session-new".  I wrote a Guile script which
successfully
imports GNUCash's guile bindings.  However, I was never able to successfully use
"qof-session-*" functions.  They are considered "unbound".

After further investigation, I found that GNUCash has unit tests that
specifically exercise the
'qof-session-new' function.
Here...'src/engine/test/test-create-account.scm'.  I ran
these units tests with 'make check' and they passed. I concluded that
since the unit test
passes, it must somehow have the binding for 'qof-session-new'.

'make check', though, creates a log for each unit test.  I peeked in
'test-create-account.scm.log'.
 I found the following line:

;;; src/engine/test/./test-create-account.scm:30:18: warning: possibly
unbound variable `qof-session-new'

This is the same error that I have encountered in my own Guile script.
But...I also see this line
at the end of the test log.

PASS test-create-account (exit status: 0)

So the unit test cannot find 'qof-session-new' and yet the unit test
framework thinks its
passing. I wanted to let someone know that GNUCash has unit tests
(perhaps only for guile)
that are returning false positives. That's bug one.  Would you like me
to file a bug for this?

It turns out that GnuCash is not properly exposing the Guile bindings.
I consider this
a "bug", but others may disagree.  GnuCash seems to work pretty well
without them.  For my
purposes, though, I know where they are defined, why they aren't
exposed, and how to expose them.
If someone wants a patch for that, I may be able to provide it.

In the meantime, the heads up here is that there are some testing
returning false positives.

Let me know if you want any more information.


More information about the gnucash-devel mailing list