isolate some code for testing in stubs.py

Also modified .gitignore to change the path to the htmlcov folder. It now appears in the parent directory where testrunner.py is located