Testing database code in CPAN modules




I've written a module that I'm getting set to upload to CPAN,
but I'd like to write some decent tests for it first.

The module is probably going to be called "GraphViz::DBI::General" [1].

What the module does is let you automatically generate a graph of
table relationships given a DBI database handle. This poses a
few problems for testing, one of which is that the data to be
plotted is table relationships, not something simple like the
contents of a table. MockDBI and SQLite are probably out of the
question.

But what's the alternative? Check for the availability of a real
database (somehow), check that I've got the permissions to do
things like "CREATE DATABASE" (somehow), and do a full blown run?

Any suggestions?



[1] My "GraphViz::DBI::General" is a subclass of the existing
"GraphViz::DBI" which is intended to work with a wider range of
databases. In particular Postgresql, for which "GraphViz::DBI" is
pretty useless (it has no concept of schemas). Also the original
module relies on a naming convention to find foreign keys, and I
prefer the DBI method "foreign_key_info" (even if it is labeled
"experimental").
.



Relevant Pages

  • Re: Problems with Lotus Smart Suite
    ... > the database that registers them thinks they have the as-read characteristics ... > during the use of Smart Suite, with, say Theseus, you'll see, if you see what I ... > then happens, somehow, is that they appear to attempt to be re-written, somehow ... > during the Lotus operation. ...
    (comp.os.os2.misc)
  • Re: Perl DBI
    ... > Doesn't the following command install the latest version of Perl DBI: ... I personally use the CPAN shell to install modules - but, ... > machine and I have a MS Access database on the Windows partition (which ...
    (comp.lang.perl.misc)
  • Statement handle still Active: prepare_cached
    ... I'm having a problem with one of my modules failing on ... The tests use SQLite for the database. ... The error is occuring on INSERT and UPDATE statements: ... but *every* CPAN tester sees this result. ...
    (perl.dbi.users)
  • Re: Statement handle still Active: prepare_cached
    ... The tests use SQLite for the database. ... get the warnings and I don't want new statement handles added to the ... You're right that INSERT or UPDATE statements shouldn't have Active set. ... but *every* CPAN tester sees this result. ...
    (perl.dbi.users)
  • DBIx::Migration::Directories version 0.07 failing tests
    ... Fetching with LWP: ... CPAN: Digest::SHA loaded ok ... User to connect to the database as ...
    (comp.lang.perl.modules)