As discussed by e-mail, this keeps a Connection to the database with each table, rather than opening and closing it for each SQL command.
Also, using the executemany command to insert values rather than looping over them brought the test time on my machine down from about 50 seconds to about 25, because it was previously doing each row in a separate transaction.
Finally, I made the table tests use SQLite's special :memory: database, which avoids writing to disk. This brought the test run down to just over 1 second.
As discussed by e-mail, this keeps a Connection to the database with each table, rather than opening and closing it for each SQL command.
Also, using the
executemany
command to insert values rather than looping over them brought the test time on my machine down from about 50 seconds to about 25, because it was previously doing each row in a separate transaction.Finally, I made the table tests use SQLite's special
:memory:
database, which avoids writing to disk. This brought the test run down to just over 1 second.