Use % formatting in logging functions (fixes #1121)
Use int() rather than long() (fixes #1120)
Merge pull request #1135 from chatcannon/pylint

Fix some pylint warnings
Print path when creating DB.
Create auxiliary setup functions.
Refactor setting up context.

* Factor setting up log file and DB.
* Fix #1011.
* Groom imports.
Group dev mode inititializing code.
Expand tests of argument parser.

* Test for correct parsing of switches, both in long and short form.
* Disable failing test of --log-level for now.
Remove unused uptime timer.

* Remove unused import.
Treat DB and log paths as single entities.

* No reason to store folder and file separately.
* Use os.path.join to be as OS-agnostic as possible.
* --log is no more; use --log-path.
* Update usage message.
Enforce --log-level to accept an int argument.
Saner Market shutdown.

* Automated mutex acquisition and release.
* Renamed variables to document signal handling API.
Hide arg_to_key inside create_argument_parser.
Move and test ensure_directory.
Stricten tests of DB creation.

* Assert that after executing setup_db, we can connect to DB.
Initial integration tests for context setup.
Move launcher tests to proper filename.