No longer need to import the train script for unit tests

Since all code was moved to modules, we can now import modules
like usual. This makes the unit tests simpler. Cleaned up some
database related code in the process.
Make it possible to start tests from the root directory