Although the idea seemed appealing, it's pretty difficult to do because
apparently :

> Without hacking sqlite3 library itself you cannot reuse |:memory:|
database, because it's guaranteed to be exclusive and private for every
connection.
> from
http://stackoverflow.com/questions/3315046/sharing-a-memory-database-between-different-threads-in-python-using-sqlite3-pa

Since the SL provider opens it's own DB connection, I don't really see
how to use a memory DB in this case (I tested the "file::memory:" trick,
but it just creates a file with this name).

Of course I could  create the DB by somehow accessing the createDB
function of the provider (no sure it's that easy since it's not in the
generic interface) an then adding features... but it seems to me a tad
overkill to go through the trouble just to avoid creating a file during
the test.


On 14/07/2013 06:16, Nathan Woodrow wrote:
>
> In tests/src/python/test_qgsspatialiteprovider.py:
>
> > +# Convenience instances in case you may need them
> > +QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
> > +
> > +
> > +def die(error_message):
> > +    raise Exception(error_message)
> > +
> > +class TestQgsSpatialiteProvider(TestCase):
> > +
> > +    @classmethod
> > +    def setUpClass(cls):
> > +        """Run before all tests"""
> > +        # create test db
> > +        if os.path.exists("test.sqlite") :
> > +            os.remove("test.sqlite")
> > +        con = sqlite3.connect("test.sqlite")
>
> I think using a memory sqlite database base might be a better idea for
> testing. http://docs.python.org/2/library/sqlite3.html#sqlite3.connect
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/qgis/Quantum-GIS/pull/715/files#r5181035>.
>