Add mercurial tests
flake8 fixes